raising the default prepareTheshold

From: Oliver Jowett <oliver(at)opencloud(dot)com>
To: pgsql-jdbc <pgsql-jdbc(at)postgresql(dot)org>
Subject: raising the default prepareTheshold
Date: 2004-09-18 21:29:04
Message-ID: 414CA8A0.7070707@opencloud.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

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

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Jeffrey Tenny 2004-09-18 21:50:59 Re: "Idle in Transaction" revisited.
Previous Message Francisco Figueiredo Jr. 2004-09-18 20:37:26 Re: Issues regarding code license of ported code.