Re: prepared statement performance

From: Barry Lind <barry(at)xythos(dot)com>
To: Sheer El-Showk <sheer(at)saraf(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: prepared statement performance
Date: 2001-07-10 01:29:29
Message-ID: 3B4A5A79.1060601@xythos.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Sheer,

If your code only runs against PostgreSQL, then the answer is that it
wouldn't be worth your time. The FE/BE protocol that the postgres JDBC
driver uses doesn't support binding variables, so the JDBC driver ends
up doing exactly what you are currently doing in your code, and builds
up a single string from all the values and sends the result to the
server. If your code also runs against other databases (for example
Oracle) then you could expect to see performance improvements as other
databases may (Oracle does) cache statements and rebind/reexecute.

thanks,
--Barry

Sheer El-Showk wrote:

> Does anyone have some handy metrics of the performance advantage of
> prepared vs unprepared statements? I'm considering the case of an
> application which has to make multiple queries/inserts (30-100) per
> application transaction and which is currenlty generating the sql by
> building the strings on the fly then passing them to the JDBC. Can I
> expect significant (ie worth the recoding time) performance increases by
> converting the statements into prepared statements?
>
> Thanks,
> Sheer
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to majordomo(at)postgresql(dot)org)
>
>

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Mike Castle 2001-07-10 01:46:10 Re: Re: Backups WAS: 2 gig file size limit
Previous Message Joseph Shraibman 2001-07-10 01:22:21 Re: Patch to remove connection hook and JDK 1.3 dependencies