pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Oliver Jowett <oliver@opencloud.com>
To: pgsql-jdbc <pgsql-jdbc@postgresql.org>
Subject: raising the default prepareTheshold
Date: Sun, 19 Sep 2004 09:29:04 +1200
Message-ID: <414CA8A0.7070707@opencloud.com> (raw)

I'd like to raise the default prepareThreshold to some non-zero value, 
perhaps 5 or so. This means that PreparedStatements that are used more 
than 5 times will allocate and use a named backend statement.

Usually, using a named statement is a performance win as it avoids 
reparsing and replanning the query on each execution; I've seen 
measurable improvement (at least 15%, from memory) on heavily-reused 
simple queries where the parse/plan cost is a noticable fraction of 
total execution time.

However, with a 8.0 backend, if the planner benefits from knowing the 
particular parameter values in use for a particular query, then using an 
unnamed statement may be faster due to using an improved plan. Under 7.4 
there will be no difference; both named and unnamed statements will use 
the generic plan.

So using named statements always by default (default prepareThreshold = 
1) probably isn't a good idea. Using a default prepareThreshold > 1 
seems like a reasonable compromise.

What does everyone think?

-O



view thread (7+ messages)  latest in thread

Message-ID: <414CA8A0.7070707@opencloud.com>
Permalink:  ../414CA8A0.7070707@opencloud.com/
Also on:    postgresql.org/message-id/414CA8A0.7070707@opencloud.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 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-jdbc@postgresql.org
  Cc: oliver@opencloud.com
  Subject: Re: raising the default prepareTheshold
  In-Reply-To: <414CA8A0.7070707@opencloud.com>
  References: <414CA8A0.7070707@opencloud.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