Slow statement when using JDBC - Mailing list pgsql-jdbc

From yazan suleiman
Subject Slow statement when using JDBC
Date
Msg-id AANLkTik_Ww_gGcNF2ntN0Emq5_KGvLN2WSDnC4BQiSTC@mail.gmail.com
Whole thread Raw
Responses Re: Slow statement when using JDBC
List pgsql-jdbc
I am running a statement with bind variable like the following:

<code>
PreparedStatement stmt = psqlConnection.prepareStatement("SELECT * FROM X WHERE X.ID=?", ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
ResultSet rs = stmt.executeQuery();
</code>

This takes 30 seconds.  On the other hand, if I run the following without binding the id:
<code>
PreparedStatement stmt = psqlConnection.prepareStatement("SELECT * FROM X WHERE X.ID=7", ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
ResultSet rs = stmt.executeQuery();
</code>

This runs in 230 ms.

I am using:
JDBC3 Postgresql Driver, Version 9.0-801 against a 9 postgres database.

Any ideas, Thanks in advance

pgsql-jdbc by date:

Previous
From: Hugo Garza
Date:
Subject: Re: My query table aliases don't exist in my application
Next
From: Maciek Sakrejda
Date:
Subject: Re: Slow statement when using JDBC