Re: [GENERAL] Prepared statement performance... - Mailing list pgsql-jdbc

From Bruce Momjian
Subject Re: [GENERAL] Prepared statement performance...
Date
Msg-id 200209271641.g8RGfFt04703@candle.pha.pa.us
Whole thread Raw
In response to Re: [GENERAL] Prepared statement performance...  (Aaron Mulder <ammulder@alumni.princeton.edu>)
List pgsql-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@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

pgsql-jdbc by date:

Previous
From: Phil Anderson
Date:
Subject: AutoGenerated Key retrieval support
Next
From: Barry Lind
Date:
Subject: Re: [GENERAL] Prepared statement performance...