Re: why partition pruning doesn't work?
Amit Langote <langote_amit_f8@lab.ntt.co.jp>
From: Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>
To: Tom Lane <tgl@sss.pgh.pa.us>, Robert Haas <robertmhaas@gmail.com>
Cc: David Rowley <david.rowley@2ndquadrant.com>,
Dmitry Dolgov <9erthalion6@gmail.com>,
Jeff Janes <jeff.janes@gmail.com>,
Ashutosh Bapat <ashutosh.bapat@enterprisedb.com>,
Pavel Stehule <pavel.stehule@gmail.com>,
PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2018-06-14T07:17:26Z
Lists: pgsql-hackers
Attachments
- open-partitioned-rels-in-ExecNonLeafAppendTables-1.patch (text/plain) patch
On 2018/06/13 23:39, Tom Lane wrote: > Robert Haas <robertmhaas@gmail.com> writes: >> Seems reasonable. Really, I think we should look for a way to hang >> onto the relation at the point where it's originally opened and locked >> instead of reopening it here. But that's probably more invasive than >> we can really justify right at the moment, and I think this is a step >> in a good direction. > > The existing coding there makes me itch a bit, because there's only a > rather fragile line of reasoning justifying the assumption that there is a > pre-existing lock at all. So I'd be in favor of what you suggest just to > get rid of the "open(NoLock)" hazard. But I agree that it'd be rather > invasive and right now is probably not the time for it. I had sent a patch to try to get rid of the open(NoLock) there a couple of months ago [1]. The idea was to both lock and open the relation in ExecNonLeafAppendTables, which is the first time all partitioned tables in a given Append node are locked for execution. Also, the patch makes it a responsibility of ExecEndAppend to release the relcache pins, so the recently added ExecDestroyPartitionPruneState would not be needed. Attached is a rebased version of that patch if there is interest in it. Thanks, Amit [1] https://www.postgresql.org/message-id/0b361a22-f995-e15c-a385-6d1b72dd0d13%40lab.ntt.co.jp
Commits
-
Fix up run-time partition pruning's use of relcache's partition data.
- e23bae82cf3d 11.0 landed
-
Fix access to just-closed relcache entry.
- bdc643e5e46f 11.0 landed
- b10edaf4bb44 10.5 landed
-
Improve ExecFindInitialMatchingSubPlans's subplan renumbering logic.
- 69025c5a07a1 11.0 landed
-
Improve commentary about run-time partition pruning data structures.
- 4e2323640333 11.0 landed
-
Fix run-time partition pruning code to handle NULL values properly.
- be3d90026a3c 11.0 landed
-
Assorted cosmetic cleanup of run-time-partition-pruning code.
- 321f648a312b 11.0 landed
-
Relocate partition pruning structs to a saner place.
- 939449de0e57 11.0 landed
-
Improve run-time partition pruning to handle any stable expression.
- 73b7f48f78d2 11.0 landed
-
Support partition pruning at execution time
- 499be013de65 11.0 cited