Re: [HACKERS] PoC plpgsql - possibility to force custom or generic plan

Pavel Stehule <pavel.stehule@gmail.com>

From: Pavel Stehule <pavel.stehule@gmail.com>
To: Robert Haas <robertmhaas@gmail.com>
Cc: Stephen Frost <sfrost@snowman.net>, Merlin Moncure <mmoncure@gmail.com>, Tom Lane <tgl@sss.pgh.pa.us>, Peter Eisentraut <peter.eisentraut@2ndquadrant.com>, Simon Riggs <simon@2ndquadrant.com>, Daniel Gustafsson <daniel@yesql.se>, 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: 2018-01-23T14:50:40Z
Lists: pgsql-hackers
2018-01-23 15:35 GMT+01:00 Robert Haas <robertmhaas@gmail.com>:

> On Mon, Jan 22, 2018 at 5:15 PM, Stephen Frost <sfrost@snowman.net> wrote:
> > Pavel,
> >
> > * Pavel Stehule (pavel.stehule@gmail.com) wrote:
> >> here is a GUC based patch for plancache controlling. Looks so this code
> is
> >> working.
> >
> > This really could use a new thread, imv.  This thread is a year old and
> > about a completely different feature than what you've implemented here.
>
> + if (plancache_mode & PLANCACHE_FORCE_GENERIC_PLAN)
> + return false;
> + if (plancache_mode & PLANCACHE_FORCE_CUSTOM_PLAN)
> + return true;
>
> This should be ==, not &.
>
> I could explain why & happens to work, but I won't.
>

you have true, thank you

Pavel


> --
> Robert Haas
> EnterpriseDB: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>

Commits

  1. Add plan_cache_mode setting

  2. Add some noreturn attributes to help static analyzers

  3. document when PREPARE uses generic plans

  4. Redesign the plancache mechanism for more flexibility and efficiency.