pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Richard Huxton <dev@archonet.com>
To: theo@flame.co.za
Cc: pgsql-performance@postgresql.org
Subject: Re: Performance problems with prepared statements
Date: Thu, 11 Oct 2007 10:12:46 +0100
Message-ID: <470DE90E.2060605@archonet.com> (raw)
In-Reply-To: <1192044840.2549.21.camel@fedmac>
References: <1192027540.2495.3.camel@localhost.localdomain>
	<470CE918.4060608@dalibo.com>
	<1192044840.2549.21.camel@fedmac>

Theo Kramer wrote:
> Thanks, had missed that, however, I am afraid that I fail to see how
> preparing a query using PQprepare() and then executing it using
> PQexecPrepared(), is 8 thousand times slower than directly executing
> it.,, ( 403386.583ms/50.0ms =  8067 ).
> 
> When doing a 'manual' prepare and explain analyze I get the following

> rascal=# explain analyze execute cq ('124         ', 8, 366942);
>  Total runtime: 3.272 ms
> 
> 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)

Are you sure you have the parameter types correct in your long-running 
query?
Try setting log_min_duration_statement=9000 or so to capture 
long-running queries.

Make sure the user and any custom settings are the same. Compare SHOW 
ALL for both ways.

You've said elsewhere you've ruled out the network environment, so 
there's not point worrying about that further.

-- 
   Richard Huxton
   Archonet Ltd



view thread (18+ messages)  latest in thread

Message-ID: <470DE90E.2060605@archonet.com>
Permalink:  ../470DE90E.2060605@archonet.com/
Also on:    postgresql.org/message-id/470DE90E.2060605@archonet.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: dev@archonet.com, theo@flame.co.za
  Subject: Re: Performance problems with prepared statements
  In-Reply-To: <470DE90E.2060605@archonet.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