From: Dave Cramer <pg@fastcrypt.com>
To: Paul Tomblin <ptomblin@gmail.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: Does "preparing" a PreparedStatement really help?
Date: Sat, 23 Feb 2008 13:14:58 -0500
Message-ID: <A2C50787-E14C-4679-BCBB-96DA09D0B697@fastcrypt.com> (raw)
In-Reply-To: <47C04916.2070500@gmail.com>
References: <47C04916.2070500@gmail.com>
Depending on the complexity of the statement, yes it does make a
difference.
You would have to measure it yourself. Your mileage would vary.
Dave
On 23-Feb-08, at 11:25 AM, Paul Tomblin wrote:
> Is there a performance advantage for preparing a PreparedStatement
> and keeping it around and using it thousands of times rather than
> making a new Statement every time? How big?
>
> Back when I was doing Oracle Call Interface programming in C back in
> the mid to late 1980s, we were always told that pre-parsing a query
> was very expensive and so you tried not to do it very often, and
> once you'd done it, you stored them to reuse. As I try to switch
> this system over to using a connection pool, trying to store
> PreparedStatements for each connection is fairly complicated and I'm
> wondering if it's worth it.
>
>
> --
> Paul Tomblin <ptomblin@xcski.com> http://blog.xcski.com/
> I wouldn't be surprised if I'd have to put garlic in the CD drawer
> to really get rid of it.
> -- Arthur van der Harg on 'Gator'
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 9: In versions below 8.0, the planner will ignore your desire to
> choose an index scan if your joining column's datatypes do not
> match
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: pg@fastcrypt.com, ptomblin@gmail.com
Subject: Re: Does "preparing" a PreparedStatement really help?
In-Reply-To: <A2C50787-E14C-4679-BCBB-96DA09D0B697@fastcrypt.com>
References: <47C04916.2070500@gmail.com> <A2C50787-E14C-4679-BCBB-96DA09D0B697@fastcrypt.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