From: Amit Langote [mailto:langote_amit...@lab.ntt.co.jp]
> Maybe, we can invent new types of plans for queries on partitioned tables
> that can be constructed by only looking at the parent relation.  We'd need
> new infrastructure before we can begin working on that though.  For
> example, until we had partitioned tables and the new partition pruning
> module specialized for partitioned tables, we had to look at every child
> to use constraint exclusion to emulate partition pruning.  Starting in PG
> 11, we now only look at the parent to perform pruning.  To perform the
> *whole planning* by just looking at the parent relation would require us
> to build more infrastructure such that, for example, an appropriate scan
> method for underlying partitions can be selected without having to open
> the children.

Although I may say the same thing as you, I think a natural idea would be to 
create a generic plan gradually.  The starting simple question is "why do we 
have to touch all partitions at first?"  That is, can we behave like this:

* PREPARE just creates an aggregation plan node (e.g. Append for SELECT, Update 
for UPDATE).  It doesn't create any plan for particular partitions.  Say, call 
this a parent generic plan node.
* EXECUTE creates a generic plan for specific partitions if they don't exist 
yet, and attach them to the parent generic plan node.


Regards
Takayuki Tsunakawa




Reply via email to