Re: performance of first exec of prepared statement

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Ted Toth <txtoth(at)gmail(dot)com>, pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: performance of first exec of prepared statement
Date: 2020-04-17 00:15:48
Message-ID: 46565270-f610-a7ef-eff2-75e23ca27bcb@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 4/16/20 4:59 PM, Ted Toth wrote:
>
>
> On Thu, Apr 16, 2020 at 6:29 PM Ted Toth <txtoth(at)gmail(dot)com
> <mailto:txtoth(at)gmail(dot)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(dot)klaver(at)aklaver(dot)com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Michael Paquier 2020-04-17 00:32:35 Re: Using of --data-checksums
Previous Message Ted Toth 2020-04-16 23:59:57 Re: performance of first exec of prepared statement