From: Laurenz Albe <laurenz.albe@cybertec.at>
To: Mladen Gogala <gogala.mladen@gmail.com>
To: pgsql-general@lists.postgresql.org
Subject: Re: How to observe plan_cache_mode transition from custom to generic plan?
Date: Mon, 06 Sep 2021 09:16:18 +0200
Message-ID: <c3dfd4fa93b7adb75f1521c74b216c1cb6d1763c.camel@cybertec.at> (raw)
In-Reply-To: <052c4c64-cd0e-9e14-ae9d-ca0e553a3bbf@gmail.com>
References: <CABR0jERKQzmE7G5nDpHDfA+502OAZaNcYY46KL=w1CtdQ1NcQw@mail.gmail.com>
<0f9c9510-f4f3-0388-b382-36063f0d4e36@gmail.com>
<3968ca671180b32b8199b2a1c1fbf9a43fa14d60.camel@cybertec.at>
<052c4c64-cd0e-9e14-ae9d-ca0e553a3bbf@gmail.com>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: laurenz.albe@cybertec.at, gogala.mladen@gmail.com
Subject: Re: How to observe plan_cache_mode transition from custom to generic plan?
In-Reply-To: <c3dfd4fa93b7adb75f1521c74b216c1cb6d1763c.camel@cybertec.at>
References: <CABR0jERKQzmE7G5nDpHDfA+502OAZaNcYY46KL=w1CtdQ1NcQw@mail.gmail.com> <0f9c9510-f4f3-0388-b382-36063f0d4e36@gmail.com> <3968ca671180b32b8199b2a1c1fbf9a43fa14d60.camel@cybertec.at> <052c4c64-cd0e-9e14-ae9d-ca0e553a3bbf@gmail.com> <c3dfd4fa93b7adb75f1521c74b216c1cb6d1763c.camel@cybertec.at>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox