Re: Does "preparing" a PreparedStatement really help?

From: Dave Cramer <pg(at)fastcrypt(dot)com>
To: Paul Tomblin <ptomblin(at)gmail(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Does "preparing" a PreparedStatement really help?
Date: 2008-02-23 18:14:58
Message-ID: A2C50787-E14C-4679-BCBB-96DA09D0B697@fastcrypt.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

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(at)xcski(dot)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

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Heikki Linnakangas 2008-02-23 19:17:19 Re: Does "preparing" a PreparedStatement really help?
Previous Message Paul Tomblin 2008-02-23 16:25:58 Does "preparing" a PreparedStatement really help?