Re: PoC plpgsql - possibility to force custom or generic plan
Pavel Stehule <pavel.stehule@gmail.com>
From: Pavel Stehule <pavel.stehule@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Daniel Gustafsson <daniel@yesql.se>,
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-05T17:51:51Z
Lists: pgsql-hackers
2017-09-05 19:38 GMT+02:00 Tom Lane <tgl@sss.pgh.pa.us>:
> Pavel Stehule <pavel.stehule@gmail.com> writes:
> > 2. what syntax we should to use (if we accept this feature)? There was
> not
> > another proposal if I remember well - The PRAGMA syntax is strong because
> > we can very well specify to range where the plans caching will be
> > explicitly controlled. It is well readable and static.
>
> The complaint I have about PRAGMA is that it's yet another syntax for
> accomplishing pretty much the same thing. If you don't like the GUC
> solution, we've already got the "comp_option" syntax for static options
> in plpgsql. Sure, that's not too pretty, but that's not a good reason
> to invent yet another way to do it.
>
comp_option has only function scope, what is too limited for this purpose.
I don't prefer GUC for this purpose because you need to do SET/RESET on two
places. With GUC the code can looks like:
PERFORM set_config('cachexx', 'off')
FOR r IN SELECT ...
LOOP
PERFORM set_config(' cachexx', 'on')
....
PERFORM set_config('cachexx', 'off')
END LOOP;
PERFORM set_config('cachexx', 'on');
The another reason for inventing PRAGMA syntax to PLpgSQL was support for
autonomous transaction and I am thinking so is good idea using same syntax
like PL/SQL does.
>
> regards, tom lane
>
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