From: | Jasen Betts <jasen(at)xnet(dot)co(dot)nz> |
---|---|
To: | pgsql-novice(at)postgresql(dot)org |
Subject: | Re: Partitioning for query performance |
Date: | 2010-04-13 12:58:42 |
Message-ID: | hq1pq2$qd2$1@reversiblemaps.ath.cx |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
On 2010-04-13, Danny Lo <lo(dot)dannyk(at)gmail(dot)com> wrote:
> This is a multi-part message in MIME format.
>
> ------=_NextPart_000_004E_01CADB39.66239FF0
> Content-Type: text/plain;
> charset="us-ascii"
> Content-Transfer-Encoding: 7bit
>
> Hi,
>
>
>
> I have a question regarding improving query performing using table
> partitioning:
I recently partitioned a 20Gb table and was amazed at the performance
boost. I only did it because I wanted to delete old data and the original
table was too busy to vacuum.
> EXECUTE 'SELECT * from
> tablename
>
> where date = ''' ||
> current_date || '''';
>
>
....
> A parameterized query will not be optimized, since the
> planner cannot know which partitions the parameter value might select at run
> time. For the same reason, "stable" functions such as CURRENT_DATE must be
> avoided.
(PLPGSQL) EXECUTE is not a parameterised query.
The way you are doing it EXECUTE sees a string with only constants in it.
In any case even without constraint exclusion you can get good (but not best)
perfromance if your parts are indexed on the relevant column; as an
index scan which discovers the requested value is too high or is too low
is very fast (not as fast as constraint exclusion, but still fast)
From | Date | Subject | |
---|---|---|---|
Next Message | Atif Jung | 2010-04-13 13:30:29 | AWK script |
Previous Message | Devrim GÜNDÜZ | 2010-04-13 12:41:38 | Re: Autvacuum and Analyze stats? |