Re: [HACKERS] Runtime Partition Pruning
Alvaro Herrera <alvherre@alvh.no-ip.org>
From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: Robert Haas <robertmhaas@gmail.com>
Cc: David Rowley <david.rowley@2ndquadrant.com>, Amit Langote <amitlangote09@gmail.com>, Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>, Jesper Pedersen <jesper.pedersen@redhat.com>, Rajkumar Raghuwanshi <rajkumar.raghuwanshi@enterprisedb.com>, Beena Emerson <memissemerson@gmail.com>, amul sul <sulamul@gmail.com>, "pgsql-hackers@postgresql.org" <pgsql-hackers@postgresql.org>, Dilip Kumar <dilipbalaut@gmail.com>
Date: 2018-04-10T21:32:03Z
Lists: pgsql-hackers
Attachments
- 0001-errbacktrace.patch (text/plain)
Robert Haas wrote: > On Mon, Apr 9, 2018 at 2:28 PM, Alvaro Herrera <alvherre@alvh.no-ip.org> wrote: > >> I don't get this. The executor surely had to (and did) open all of > >> the relations somewhere even before this patch. > > I was worried that this coding could be seen as breaking modularity, or > > trying to do excessive work. However, after looking closer at it, it > > doesn't really look like it's the case. So, nevermind. > > Well what I'm saying is that it shouldn't be necessary. If the > relations are being opened already and the pointers to the relcache > entries are being saved someplace, you shouldn't need to re-open them > elsewhere to get pointers to the relcache entries. I looked a bit more into this. It turns out that we have indeed opened the relation before -- first in parserOpenTable (for addRangeTableEntry), then in expandRTE, then in QueryRewrite, then in subquery_planner, then in get_relation_info. So, frankly, since each module thinks it's okay to open it every once in a while, I'm not sure we should be terribly stressed about doing it once more for partition pruning. Particularly since communicating the pointer seems to be quite troublesome. To figure out, I used the attached patch (not intended for application) to add a backtrace to each log message, plus a couple of accusatory elog() calls in relation_open and ExecSetupPartitionPruneState. -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, 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