Re: Ordered Partitioned Table Scans

Amit Langote <langote_amit_f8@lab.ntt.co.jp>

From: Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>
To: David Rowley <david.rowley@2ndquadrant.com>, Julien Rouhaud <rjuju123@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, Robert Haas <robertmhaas@gmail.com>, Antonin Houska <ah@cybertec.at>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2019-03-27T06:48:33Z
Lists: pgsql-hackers
Hi David,

Sorry if this was discussed before, but why does this patch add any new
code to partprune.c?  AFAICT, there's no functionality changes to the
pruning code.

Both

+bool
+partkey_is_bool_constant_for_query(RelOptInfo *partrel, int partkeycol)

and

+static bool
+matches_boolean_partition_clause(RestrictInfo *rinfo, int partkeycol,
+                                 RelOptInfo *partrel)

seem like their logic is specialized enough to be confined to pathkeys.c,
only because it's needed there.


Regarding

+bool
+partitions_are_ordered(PlannerInfo *root, RelOptInfo *partrel)

I think this could simply be:

bool
partitions_are_ordered(PartitionBoundInfo *boundinfo)

and be defined in partitioning/partbounds.c.  If you think any future
modifications to this will require access to the partition key info in
PartitionScheme, maybe the following is fine:

bool
partitions_are_ordered(RelOptInfo *partrel)

Thanks,
Amit




Commits

  1. Use Append rather than MergeAppend for scanning ordered partitions.