Re: Prepare Statement

From: "Jie Liang" <jie(at)stbernard(dot)com>
To: "Kris Jurka" <books(at)ejurka(dot)com>
Cc: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, <pgsql-sql(at)postgresql(dot)org>, <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: Prepare Statement
Date: 2004-06-17 18:18:56
Message-ID: E7E213858379814A9AE48CA6754F5ECB034518F9@mail01.stbernard.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc pgsql-sql

Kirs,

I re-compile with setUseServerPrepare(true), it works fine, thanks.
However, reading from my log file, what I saw is that five same SELECTs
with different argument, so I am wondering that the PrepareStatement
really save time than individualy execute five SELECTs ???

If I use one "parepare sql command" and five "execute sql commands", the
log file shown what I typed, so I think it really used server side
prepared object!

Any comment?

Thanks.

Jie Liang

-----Original Message-----
From: Kris Jurka [mailto:books(at)ejurka(dot)com]
Sent: Wednesday, June 16, 2004 9:30 PM
To: Jie Liang
Cc: Tom Lane; pgsql-sql(at)postgresql(dot)org; pgsql-jdbc(at)postgresql(dot)org
Subject: Re: [JDBC] Prepare Statement

On Wed, 16 Jun 2004, Jie Liang wrote:

> Kris,
> Thank you for your valuable response, I used the code you list
> following:
>
> [7.5 code example]
>
> Then, the compiler complaint:
> ServerSidePreparedStatement.java:20: cannot resolve symbol symbol :
> method setPrepareThreshold (int)
> location: interface org.postgresql.PGStatement
> pgstmt.setPrepareThreshold(3); I downloaded
> pg74.213.jdbc2.jar and pg74.213.jdbc2ee.jar at

This example is from the 7.5 documentation and requires a
pgdev.302.jdbcX.jar file. I mentioned this cvs example because this
functionality is undocumented in the released version. In the 7.4
version
the enabling of server side statements is only possible via a boolean
flag
at the statement level, namely PGStatement.setUseServerPrepare(true);

Kris Jurka

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Kris Jurka 2004-06-17 18:59:28 Re: Prepare Statement
Previous Message Barry Lind 2004-06-17 15:56:03 Re: Nested transactions

Browse pgsql-sql by date

  From Date Subject
Next Message Kris Jurka 2004-06-17 18:59:28 Re: Prepare Statement
Previous Message Bruno Wolff III 2004-06-17 17:54:22 Re: Optimal query suggestion needed