pg.ddx.io pgsql-sql@postgresql.org mailing list archivehelp / color / mirror / Atom feed
From: Kris Jurka <books@ejurka.com>
To: Jie Liang <jie@stbernard.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-sql@postgresql.org
Cc: pgsql-jdbc@postgresql.org
Subject: Re: Prepare Statement
Date: Tue, 15 Jun 2004 13:00:00 -0500 (EST)
Message-ID: <Pine.BSO.4.56.0406151238310.10395@leary.csoft.net> (raw)
In-Reply-To: <E7E213858379814A9AE48CA6754F5ECB02A70FCA@mail01.stbernard.com>
References: <E7E213858379814A9AE48CA6754F5ECB02A70FCA@mail01.stbernard.com>
On Mon, 14 Jun 2004, Jie Liang wrote:
> I have a question about performance, in SQL commands: there is a
> prepare/execute command, document says it will improve the performance
> while repeatly execute a statement. In java.sql: there is a
> PreparedStatement object, which can store precompiled SQL statement,
> document says it can improve the performance also.
> If I use java jdbc to connect postgresql database, which one I should
> use? Can I use both?
>
When using JDBC it is best to use the standard Statement/PreparedStatement
interfaces. It is possible to directly use PREPARE/EXECUTE, but this can
be handled by the driver. Let me give you a run down of the different
driver versions and their capabilities:
Current released version: can enable using PREPARE/EXECUTE behind the
scenes on PreparedStatement by casting the prepared statement to
PGStatement and issuing setUseServerPrepare.
Current cvs version: can enable using PREPARE/EXECUTE by setting an
execution threshold that will turn it on when reached. This threshold can
be set at a number of levels, see the following for more information
http://www.ejurka.com/pgsql/docs/cvs/ch09s05.html
Soon to be committed cvs version: can directly use server prepared
statements without using the SQL level PREPARE/EXECUTE.
Kris Jurka
view thread (19+ messages) latest in thread
Message-ID: <Pine.BSO.4.56.0406151238310.10395@leary.csoft.net> Permalink: ../Pine.BSO.4.56.0406151238310.10395@leary.csoft.net/ Also on: postgresql.org/message-id/Pine.BSO.4.56.0406151238310.10395@leary.csoft.net ·
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 using the --to and --cc options: reply via email To: pgsql-sql@postgresql.org Cc: books@ejurka.com, jie@stbernard.com, tgl@sss.pgh.pa.us, pgsql-jdbc@postgresql.org Subject: Re: Prepare Statement In-Reply-To: <Pine.BSO.4.56.0406151238310.10395@leary.csoft.net> * 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