Re: Performance problems with prepared statements

From: Theo Kramer <theo(at)flame(dot)co(dot)za>
To: pgsql-performance(at)postgresql(dot)org
Subject: Re: Performance problems with prepared statements
Date: 2007-10-12 07:38:01
Message-ID: 1192174681.2470.12.camel@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Thu, 2007-10-11 at 13:28 -0400, Merlin Moncure wrote:
> On 10/11/07, Theo Kramer <theo(at)flame(dot)co(dot)za> wrote:
> > On Thu, 2007-10-11 at 10:12 +0100, Richard Huxton wrote:
> > > Theo Kramer wrote:
> > > >
> > > > So I suspect that there is something more fundamental here...
> > >
> > > OK, so there must be something different between the two scenarios. It
> > > can only be one of:
> > > 1. Query
> > > 2. DB Environment (user, locale, settings)
> > > 3. Network environment (server/client/network activity etc)
> >
> > I suspect that it could also be in the way the libpq PQprepare(), and
> > PQexecPrepared() are handled... as opposed to the way PREPARE and
> > EXECUTE are handled.
>
> PQexecPrepared is generally the fastest way to run queries from a C
> app as long as you get the right plan. Some suggestions
>
> * you can explain/explain analyze executing prepared statements from
> psql shell...try that and see if you can reproduce results

Did that - see previous emails in this thread.

> * at worst case you can drop to execParams which is faster (and
> better) than PQexec, at least

Thanks - will keep that option open.

> * if problem is plan related, you can always disable certain plan
> types (seqscan), prepare, and re-enable those plan types
> * do as Jonah suggested, first step is to try and reproduce problem from psql

No success on that.
--
Regards
Theo

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Theo Kramer 2007-10-12 08:05:35 Re: Performance problems with prepared statements
Previous Message Theo Kramer 2007-10-12 07:35:02 Re: Performance problems with prepared statements