Re: [HACKERS] Runtime Partition Pruning
David Rowley <david.rowley@2ndquadrant.com>
From: David Rowley <david.rowley@2ndquadrant.com>
To: Beena Emerson <memissemerson@gmail.com>
Cc: Alvaro Herrera <alvherre@alvh.no-ip.org>,
Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>, Robert Haas <robertmhaas@gmail.com>, amul sul <sulamul@gmail.com>, "pgsql-hackers@postgresql.org" <pgsql-hackers@postgresql.org>,
Dilip Kumar <dilipbalaut@gmail.com>
Date: 2018-01-06T11:03:54Z
Lists: pgsql-hackers
Attachments
- runtime_prune_drowley_v6.patch (application/octet-stream) patch v6
On 6 January 2018 at 07:31, Beena Emerson <memissemerson@gmail.com> wrote: > It does not handle change in column order (varattno) in subpartitions. Thanks for testing and finding that. I completely overlooked applying translation of the prune qual so that it's compatible with the sub-partition. I've fixed this in the attached, but I did so by calling adjust_appendrel_attrs() from the nodeAppend.c, which did, of course, mean that the AppendRelInfo needed to be given to the executor. I was also a bit unsure what exactly I should be doing in primnodes.h, since I've put PartitionPruneInfo in there, but AppendRelInfo is not. I stuck a quick declaration of AppendRelInfo in primnode.h with an XXX comment so we don't forget to think about that again. In all honesty, this calling planner code from the executor seems like quite new ground for PostgreSQL, so I'm really not sure if we're breaking any major rules or not with we've got now. Perhaps the saving grace here is that we're not teaching the executor how to do anything smart with these data structures, they're just given to it to pass back to the planner function at the appropriate moment. I've also borrowed and simplified your test case to ensure this fix remains working. I added another level of partitioning with another partition that has the columns in a different order again. This is to ensure the translation code translates from the quals of the previous level up, not the top-level. That's required since the AppendRelInfo is only translating 1 level at a time. -- David Rowley http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services
Commits
-
Initialize ExprStates once in run-time partition pruning
- 1957f8dabf8d 11.0 landed
-
Add bms_prev_member function
- 5c0675215e15 11.0 landed
-
Support partition pruning at execution time
- 499be013de65 11.0 landed
-
Document partprune.c a little better
- 971d7ddbe19a 11.0 landed
-
Fix crash in pg_replication_slot_advance
- 6f1d723b6359 11.0 cited
-
Add parallel-aware hash joins.
- 1804284042e6 11.0 cited
-
Fix typo.
- 487a0c1518af 11.0 cited
-
Allow --with-bonjour to work with non-macOS implementations of Bonjour.
- 9b9cb3c4534d 11.0 cited
-
Mention need for --no-inc-recursive in rsync command
- 2c74e6c1dcc5 11.0 cited