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