pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Merlin Moncure <mmoncure@gmail.com>
To: theo@flame.co.za
Cc: pgsql-performance@postgresql.org
Subject: Re: Performance problems with prepared statements
Date: Thu, 11 Oct 2007 13:28:51 -0400
Message-ID: <b42b73150710111028h51a6798agf862e5e88cbc123c@mail.gmail.com> (raw)
In-Reply-To: <1192098798.2507.26.camel@localhost.localdomain>
References: <1192027540.2495.3.camel@localhost.localdomain>
	<470CE918.4060608@dalibo.com>
	<1192044840.2549.21.camel@fedmac>
	<470DE90E.2060605@archonet.com>
	<1192098798.2507.26.camel@localhost.localdomain>

On 10/11/07, Theo Kramer <theo@flame.co.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
* at worst case you can drop to execParams which is faster (and
better) than PQexec, at least
* 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

merlin



view thread (18+ messages)  latest in thread

Message-ID: <b42b73150710111028h51a6798agf862e5e88cbc123c@mail.gmail.com>
Permalink:  ../b42b73150710111028h51a6798agf862e5e88cbc123c@mail.gmail.com/
Also on:    postgresql.org/message-id/b42b73150710111028h51a6798agf862e5e88cbc123c@mail.gmail.com

 · 

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: pgsql-performance@postgresql.org
  Cc: mmoncure@gmail.com, theo@flame.co.za
  Subject: Re: Performance problems with prepared statements
  In-Reply-To: <b42b73150710111028h51a6798agf862e5e88cbc123c@mail.gmail.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