public inbox for [email protected]
help / color / mirror / Atom feedFrom: Rob Sargent <[email protected]>
To: Tom Lane <[email protected]>
Cc: Igor Korot <[email protected]>
Cc: pgsql-generallists.postgresql.org <[email protected]>
Subject: Re: Double prepare
Date: Sat, 16 May 2026 08:07:01 -0600
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
> On May 16, 2026, at 7:46 AM, Tom Lane <[email protected]> wrote:
>
> Igor Korot <[email protected]> writes:
>> Is there a way to see if the query has been prepared already (in libpq)?
>
> Use the pg_prepared_statements view. I don't think libpq keeps any
> client-side state about this.
>
>> Or is it better to run for all known parameterized queries
>> in the very beginning of the program and just execute them when needed?
>
> Very probably. Querying every time would be
> expensive.
>
If I am following correctly, one may query pg_prepared_statements with a specific query in hand. Should it not then be possible to cache that query as having been planned/prepared and proceed accordingly?
Might there be value in calling PQprepare as late as possible against most up-to-dare data?
>
reply
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 using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected], [email protected]
Subject: Re: Double prepare
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox