Re: Problem with default partition pruning

Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp>

From: Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp>
To: hosoya.yuzuko@lab.ntt.co.jp
Cc: Langote_Amit_f8@lab.ntt.co.jp, thibaut.madelaine@dalibo.com, imai.yoshikazu@jp.fujitsu.com, pgsql-hackers@lists.postgresql.org
Date: 2019-04-09T08:51:24Z
Lists: pgsql-hackers
At Tue, 09 Apr 2019 17:37:25 +0900 (Tokyo Standard Time), Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp> wrote in <20190409.173725.31175835.horiguchi.kyotaro@lab.ntt.co.jp>
> > I'm attaching the latest version.  Could you please check it again?

By the way, I noticed that partition constraint in a multi-level
partition contains duplicate clauses.

create table p (a int) partition by range (a);
create table c1 partition of p for values from (0) to (10) partition by range (a);
create table c11 partition of c1 for values from (0) to (2) partition by range (a);
create table c12 partition of c1 for values from (2) to (4) partition by range (a);

=# \d+ c12
|                               Partitioned table "public.c12"
|  Column |  Type   | Collation | Nullable | Default | Storage | Stats target | De
| scription 
| --------+---------+-----------+----------+---------+---------+--------------+---
| ----------
|  a      | integer |           |          |         | plain   |              | 
| Partition of: c1 FOR VALUES FROM (2) TO (4)
| Partition constraint: ((a IS NOT NULL) AND (a >= 0) AND (a < 10) AND (a IS NOT N
| ULL) AND (a >= 2) AND (a < 4))
| Partition key: RANGE (a)
| Number of partitions: 0


The partition constraint is equivalent to "(a IS NOT NULL) AND (a
>= 2) AND (a < 4)". Is it intentional (for, for example,
performance reasons)? Or is it reasonable to deduplicate the
quals?

regards.

-- 
Kyotaro Horiguchi
NTT Open Source Software Center




Commits

  1. Don't constraint-exclude partitioned tables as much

  2. Apply constraint exclusion more generally in partitioning

  3. Improve pruning of a default partition

  4. Doc: Fix event trigger firing table

  5. Remove obsolete nbtree insertion comment.