Re: How to observe plan_cache_mode transition from custom to generic plan?

From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
To: Mladen Gogala <gogala(dot)mladen(at)gmail(dot)com>, pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: How to observe plan_cache_mode transition from custom to generic plan?
Date: 2021-09-06 07:16:18
Message-ID: c3dfd4fa93b7adb75f1521c74b216c1cb6d1763c.camel@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, 2021-09-06 at 03:07 -0400, Mladen Gogala wrote:
>
> On 9/6/21 2:26 AM, Laurenz Albe wrote:
> > "Bind variables" just being an Oraclism for parameters, it is*not*  a
> > mistake to use them in PostgreSQL.
>
> Actually, it is a mistake because they don't give you any performance
> benefit and can potentially worsen the performance. There is no cursor
> sharing and generic plans can be much worse than "custom" plans,
> generated with the actual values. The only reason for using bind
> variables/parameters is to protect yourself from SQL injection.

I disagree. There is defnitely a performance benefit in not generating
a plan for each execution, even if plans are only cached per session.

Yours,
Laurenz Albe
--
Cybertec | https://www.cybertec-postgresql.com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Nick Renders 2021-09-06 07:51:21 pg_upgrade - fe_sendauth: no password supplied
Previous Message Mladen Gogala 2021-09-06 07:07:16 Re: How to observe plan_cache_mode transition from custom to generic plan?