Re: [HACKERS] path toward faster partition pruning - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [HACKERS] path toward faster partition pruning
Date
Msg-id 25291.1522174358@sss.pgh.pa.us
Whole thread Raw
In response to Re: [HACKERS] path toward faster partition pruning  (Alvaro Herrera <alvherre@alvh.no-ip.org>)
List pgsql-hackers
Alvaro Herrera <alvherre@alvh.no-ip.org> writes:
> Amit Langote wrote:
>> [Jesper] also pointed out a case with a
>> list-partitioned table where pruning doesn't a produce a result as one
>> would expect and what constraint exclusion would produce.
>> 
>> create table lp (a char) partition by list (a);
>> create table lp_ad partition of lp for values in ('a', 'd');
>> create table lp_bc partition of lp for values in ('b', 'c');
>> create table lp_default partition of lp default;
>> explain (costs off) select * from lp where a > 'a' and a < 'd';
>> QUERY PLAN
>> -----------------------------------------------------------
>> Append
>> ->  Seq Scan on lp_ad
>> Filter: ((a > 'a'::bpchar) AND (a < 'd'::bpchar))
>> ->  Seq Scan on lp_bc
>> Filter: ((a > 'a'::bpchar) AND (a < 'd'::bpchar))
>> ->  Seq Scan on lp_default
>> Filter: ((a > 'a'::bpchar) AND (a < 'd'::bpchar))
>> (7 rows)
>> 
>> One would expect that lp_ad is not scanned.

> One would?  I, for one, wouldn't particularly sweat over this case TBH.

That example works in HEAD, so if somebody is proposing a patch that
breaks it, seems like that needs investigation.

            regards, tom lane


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Changing WAL Header to reduce contention during ReserveXLogInsertLocation()
Next
From: Peter Geoghegan
Date:
Subject: Re: [HACKERS] MERGE SQL Statement for PG11