pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Erik Price <eprice@ptc.com>
To: Julien Le Goff <julien.legoff@laposte.net>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: Prepared Statements
Date: Wed, 16 Jul 2003 16:49:49 -0400
Message-ID: <3F15BA6D.7070106@ptc.com> (raw)
In-Reply-To: <200307161624.39340.julien.legoff@laposte.net>
References: <200307161624.39340.julien.legoff@laposte.net>



Julien Le Goff wrote:
> Hello everyone,
> 
> I have a question regarding the efficiency of Prepared Statements. I'm 
> working on a project, and my task now is to decide whether it's worth 
> it to use PS. This problem came up when, beginning to implement jdbc 
> classes, we noticed that we would need a lot of PS - something like 40 
> per class. Each PS would be a class variable, and it sounds weird to 
> have 40 class variables... We could have a more elegant system using 
> normal statements, but would it be much less efficient?

My understanding is that the efficiency of a PreparedStatement really 
depends on the database.  I have no information about this subject in 
reference to PostgreSQL (or any other database), however.

Usually you will want to use a PreparedStatement so that in the case 
where a database -does- make use of it and caches the query, it will be 
done.  However, you've mentioned that you have an equally performant and 
more elegant solution using regular queries.  I'd go with elegance until 
you really need the performance.



Erik




view thread (105+ messages)  latest in thread

Message-ID: <3F15BA6D.7070106@ptc.com>
Permalink:  ../3F15BA6D.7070106@ptc.com/
Also on:    postgresql.org/message-id/3F15BA6D.7070106@ptc.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: eprice@ptc.com, julien.legoff@laposte.net
  Subject: Re: Prepared Statements
  In-Reply-To: <3F15BA6D.7070106@ptc.com>
  References: <200307161624.39340.julien.legoff@laposte.net> <3F15BA6D.7070106@ptc.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