Re: PG11 - Multiple Key Range Partition
David Rowley <david.rowley@2ndquadrant.com>
From: David Rowley <david.rowley@2ndquadrant.com>
To: Rares Salcudean <rares.salcudean@takeofflabs.com>
Cc: PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>
Date: 2019-07-09T23:32:54Z
Lists: pgsql-bugs
On Tue, 9 Jul 2019 at 18:53, Rares Salcudean
<rares.salcudean@takeofflabs.com> wrote:
> The example you suggested:
>
> explain select * from scores where NOT(recent = true) and NOT(deleted = true) and played_at = '2018-03-02'
> explain select * from scores where NOT(recent) and NOT(deleted) and played_at = '2018-03-02'
>
> Yield the same result:
Works okay for me with:
create table rangep (a bool, b bool, c date) partition by range (a,b,c);
create table rangep1 partition of rangep for values from (false,
false, '2019-01-01') to (false,false,'2020-01-01');
create table rangep2 partition of rangep for values from (true, true,
'2019-01-01') to (true,true,'2020-01-01');
explain select * from rangep where not a and not b and c = '2019-07-10';
QUERY PLAN
--------------------------------------------------------------
Seq Scan on rangep1 (cost=0.00..40.00 rows=3 width=6)
Filter: ((NOT a) AND (NOT b) AND (c = '2019-07-10'::date))
(2 rows)
That's on master, but v10 and v11 still prune away rangep2.
It might help if you share which version you're using and a cutdown
version of the schema, just enough to show the issue.
--
David Rowley http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
Commits
-
Fix RANGE partition pruning with multiple boolean partition keys
- cfde23493938 13.0 landed
- 30a268ed2e29 12.0 landed
- 757f1baa8c13 11.5 landed