Skip site navigation (1) Skip section navigation (2)

prepareThreshold=1 and statement.executeBatch() ??

From: Joost Kraaijeveld <J(dot)Kraaijeveld(at)Askesis(dot)nl>
To: "pgsql-jdbc(at)postgresql(dot)org" <pgsql-jdbc(at)postgresql(dot)org>
Subject: prepareThreshold=1 and statement.executeBatch() ??
Date: 2005-11-13 06:48:05
Message-ID: 1131864485.6535.26.camel@Panoramix (view raw or flat)
Thread:
Lists: pgsql-hackerspgsql-jdbc
Hi,

I have a connection that is created with "prepareThreshold=1" in the
connection string. I use a prepared statement that I fill with
addbatch() and that I execute with executeBatch() (for full source: see
"application.java" attachment).

Tracing all statements in my PostgreSQL logs I see (for the full log:
see "postgresql.log" attachement):

LOG:  statement: PREPARE S_2 AS update prototype.customers set title=
$1 , defaultcurrency=$2, defaulttermsofdelivery=$3 ,
defaulttermsofpayment=$4 where customernumber=$5
LOG:  statement: <BIND>
LOG:  statement: EXECUTE <unnamed>  [PREPARE:  update
prototype.customers set title=$1 , defaultcurrency=$2, defaultter
msofdelivery=$3, defaulttermsofpayment=$4 where customernumber=$5]
LOG:  duration: 773.841 ms
LOG:  statement: <BIND>
LOG:  statement: EXECUTE <unnamed>  [PREPARE:  update
prototype.customers set title=$1 , defaultcurrency=$2, defaultter
msofdelivery=$3, defaulttermsofpayment=$4 where customernumber=$5]
LOG:  duration: 377.981 ms

Does this output mean that the prepared statement with the name "S_2" is
not used in the following 2 EXECUTE statements and that therefor each
execute statement is planned again? 

BTW: I used PostgreSQL 8.1 and PostgreSQL-8.1-404.jdbc3.jar.

TIA

-- 
Groeten,

Joost Kraaijeveld
Askesis B.V.
Molukkenstraat 14
6524NB Nijmegen
tel: 024-3888063 / 06-51855277
fax: 024-3608416
e-mail: J(dot)Kraaijeveld(at)Askesis(dot)nl
web: www.askesis.nl 



Attachment: postgresql.log
Description: text/x-log (2.7 KB)
Attachment: Application.java
Description: text/x-java (4.6 KB)

Responses

pgsql-hackers by date

Next:From: Kris JurkaDate: 2005-11-13 09:27:08
Subject: Re: prepareThreshold=1 and statement.executeBatch() ??
Previous:From: Kevin BrownDate: 2005-11-13 06:46:33
Subject: Re: SIGSEGV taken on 8.1 during dump/reload

pgsql-jdbc by date

Next:From: Kris JurkaDate: 2005-11-13 08:50:56
Subject: Re: passing array as parameters to PrepareStatement or callable
Previous:From: Assad JarrahianDate: 2005-11-12 17:21:32
Subject: passing array as parameters to PrepareStatement or callable statement.[setObject() or setArray()]

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group