Re: PoC plpgsql - possibility to force custom or generic plan
Pavel Stehule <pavel.stehule@gmail.com>
From: Pavel Stehule <pavel.stehule@gmail.com>
To: Daniel Gustafsson <daniel@yesql.se>
Cc: Simon Riggs <simon@2ndquadrant.com>, Robert Haas <robertmhaas@gmail.com>, Tom Lane <tgl@sss.pgh.pa.us>,
Peter Eisentraut <peter.eisentraut@2ndquadrant.com>, Andrew Dunstan <andrew.dunstan@2ndquadrant.com>,
Andres Freund <andres@anarazel.de>, Petr Jelinek <petr.jelinek@2ndquadrant.com>,
David Steele <david@pgmasters.net>, PostgreSQL Hackers <pgsql-hackers@postgresql.org>,
Jim Nasby <Jim.Nasby@bluetreble.com>
Date: 2017-09-08T19:48:33Z
Lists: pgsql-hackers
2017-09-08 21:21 GMT+02:00 Daniel Gustafsson <daniel@yesql.se>: > > On 08 Sep 2017, at 19:14, Simon Riggs <simon@2ndquadrant.com> wrote: > > > > On 6 September 2017 at 07:43, Robert Haas <robertmhaas@gmail.com> wrote: > > > >> LET custom_plan_tries = 0 IN SELECT ... > > > > Tom has pointed me at this proposal, since on another thread I asked > > for something very similar. (No need to reprise that discussion, but I > > wanted prepared queries to be able to do SET work_mem = X; SELECT). > > This idea looks a good way forward to me. > > > > Since we're all in roughly the same place, I'd like to propose that we > > proceed with the following syntax... whether or not this precisely > > solves OP's issue on this thread. > > > > 1. Allow SET to set multiple parameters... > > SET guc1 = x, guc2 = y > > This looks fairly straightforward > > > > 2. Allow a SET to apply only for a single statement > > SET guc1 = x, guc2 = y FOR stmt > > e.g. SET max_parallel_workers = 4 FOR SELECT count(*) FROM bigtable > > Internally a GUC setting already exists for a single use, via > > GUC_ACTION_SAVE, so we just need to invoke it. > > This syntax proposal makes sense, +1. My immediate thought was that the > per-statement GUCs were sort of like options, and most options in our > syntax > are enclosed with (), like: SET (guc1 = x, guc2 = y) FOR SELECT ..; > we newer support this syntax in combination with SET keyword see - CREATE FUNCTION command personally I prefer syntax without FOR keyword - because following keyword must be reserved keyword SET x = .., y = .. SELECT ... ; Regards Pavel > cheers ./daniel >
Commits
-
Add plan_cache_mode setting
- f7cb2842bf47 12.0 landed
-
Add some noreturn attributes to help static analyzers
- a044378ce2f6 11.0 cited
-
document when PREPARE uses generic plans
- fab9d1da4a21 9.6.0 cited
-
Redesign the plancache mechanism for more flexibility and efficiency.
- e6faf910d750 9.2.0 cited