From: | Aniko Belim <anikob(at)spiceworks(dot)com> |
---|---|
To: | Justin Pryzby <pryzby(at)telsasoft(dot)com> |
Cc: | "pgsql-performance(at)postgresql(dot)org" <pgsql-performance(at)postgresql(dot)org> |
Subject: | Re: Partitioned table - scans through every partitions |
Date: | 2017-08-25 16:08:19 |
Message-ID: | A05FD56F-D5AE-45D6-BDAD-32AF48B532A9@spiceworks.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-performance |
Thank you, Justin!
Aniko
On 8/25/17, 10:44 AM, "Justin Pryzby" <pryzby(at)telsasoft(dot)com> wrote:
>On Fri, Aug 25, 2017 at 03:36:29PM +0000, Aniko Belim wrote:
>> Hi,
>>
>> We have an issue with one of our partitioned tables. It has a column with timestamp without time zone type, and we had to partition it daily. To do that, we created the following constraints like this example:
>> CHECK (to_char(impression_time, 'YYYYMMDD'::text) = '20170202'::text)
>>
>>
>> The problem we’re facing is no matter how we’re trying to select from it, it scans through every partitions.
>
>
>> It scans through every partitions. Shouldn’t it only scan the dfp_in_network_impressions.dfp_in_network_impressions_20170202 child table? Or we missing something?
>> Any advice/help would highly appreciated.
>
>https://www.postgresql.org/docs/9.6/static/ddl-partitioning.html#DDL-PARTITIONING-CAVEATS
>|The following caveats apply to constraint exclusion:
>| Constraint exclusion only works when the query's WHERE clause contains
>| constants (or externally supplied parameters). For example, a comparison
>| against a non-immutable function such as CURRENT_TIMESTAMP cannot be
>| optimized, since the planner cannot know which partition the function value
>| might fall into at run time.
>
>...
From | Date | Subject | |
---|---|---|---|
Next Message | Felix Geisendörfer | 2017-08-27 10:56:20 | Re: 10x faster sort performance on Skylake CPU vs Ivy Bridge |
Previous Message | Justin Pryzby | 2017-08-25 15:44:34 | Re: Partitioned table - scans through every partitions |