From: Adrian Klaver <adrian.klaver@aklaver.com>
To: Ted Toth <txtoth@gmail.com>
To: pgsql-general <pgsql-general@postgresql.org>
Subject: Re: performance of first exec of prepared statement
Date: Thu, 16 Apr 2020 17:15:48 -0700
Message-ID: <46565270-f610-a7ef-eff2-75e23ca27bcb@aklaver.com> (raw)
In-Reply-To: <CAFPpqQEmfVKRJ7KSJtAKi1vUusXYMyBuW85NPqqqLP17Z8gKDg@mail.gmail.com>
References: <CAFPpqQGfvPcSjvJ6t8Bibv_MdxXix=s54C0P-JQP5BCc6SqtwA@mail.gmail.com>
<CAFPpqQEmfVKRJ7KSJtAKi1vUusXYMyBuW85NPqqqLP17Z8gKDg@mail.gmail.com>
On 4/16/20 4:59 PM, Ted Toth wrote:
>
>
> On Thu, Apr 16, 2020 at 6:29 PM Ted Toth <txtoth@gmail.com
> <mailto:txtoth@gmail.com>> wrote:
>
> I've noticed that the first exec of an INSERT prepared statement
> takes ~5 time longer (I'm using libpq in C and wrapping the calls to
> time them) then subsequent exec's is this the expected behavior and
> if so is there any thing I can do to mitigate this affect?
>
> Ted
>
>
> For example (in my environment) I'm seeing the prepare take ~10ms, the
> first exec take ~30 ms and subsequent exec's take ~4 ms.
>
I don't have an answer. I believe though that to help those that might
it would be helpful to show the actual code.
--
Adrian Klaver
adrian.klaver@aklaver.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: adrian.klaver@aklaver.com, txtoth@gmail.com
Subject: Re: performance of first exec of prepared statement
In-Reply-To: <46565270-f610-a7ef-eff2-75e23ca27bcb@aklaver.com>
References: <CAFPpqQGfvPcSjvJ6t8Bibv_MdxXix=s54C0P-JQP5BCc6SqtwA@mail.gmail.com> <CAFPpqQEmfVKRJ7KSJtAKi1vUusXYMyBuW85NPqqqLP17Z8gKDg@mail.gmail.com> <46565270-f610-a7ef-eff2-75e23ca27bcb@aklaver.com>
* 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