Skip site navigation (1) Skip section navigation (2)

Re: [JDBC] Prepared statement performance...

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Aaron Mulder <ammulder(at)alumni(dot)princeton(dot)edu>
Cc: Dave Cramer <Dave(at)micro-automation(dot)net>,Peter Kovacs <peter(dot)kovacs(at)sysdata(dot)siemens(dot)hu>,Barry Lind <barry(at)xythos(dot)com>, Dmitry Tkach <dmitry(at)openratings(dot)com>,"pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>,"pgsql-jdbc(at)postgresql(dot)org" <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: [JDBC] Prepared statement performance...
Date: 2002-09-27 16:41:14
Message-ID: 200209271641.g8RGfFt04703@candle.pha.pa.us (view raw or flat)
Thread:
Lists: pgsql-generalpgsql-jdbc
Aaron Mulder wrote:
> Dave, Barry, et al.:
> 
> > Unless of course we were to write a
> > sql parser in the jdbc driver so that we could predetermine which
> > statements should use the prepare mechanism or not.
> 
> 	That's a bit of an exaggeration -- all you need to check in the 
> JDBC driver is whether there's an unescaped ; to see if there's more than 
> one statement, right?  It wouldn't be unreasonable to default to enabling 
> the feature unless there's a ; in the statement (or unless there's a ; 
> with anything but whitespace afterward, if you like) -- it wouldn't even 
> be a disaster to forget escaping and just decide based on a ; in the 
> statement period -- few enough statements have an escaped ; that the 
> suboptimal performance in that case won't matter.

psql does do this by tracking quotes and parens and looking for ';'.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman(at)candle(dot)pha(dot)pa(dot)us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

In response to

pgsql-jdbc by date

Next:From: Barry LindDate: 2002-09-27 18:24:39
Subject: Re: [JDBC] Prepared statement performance...
Previous:From: Phil AndersonDate: 2002-09-27 13:55:30
Subject: AutoGenerated Key retrieval support

pgsql-general by date

Next:From: Joe ConwayDate: 2002-09-27 16:44:55
Subject: Re: [SQL] function return multiply rows
Previous:From: Tom LaneDate: 2002-09-27 16:40:02
Subject: Re: cache state reset

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group