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
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general 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(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

Browse pgsql-general by date

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

Browse pgsql-jdbc by date

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