From: | yazan suleiman <yazan(dot)suleiman(at)gmail(dot)com> |
---|---|
To: | pgsql-jdbc(at)postgresql(dot)org |
Subject: | Slow statement when using JDBC |
Date: | 2011-02-02 19:38:17 |
Message-ID: | AANLkTik_Ww_gGcNF2ntN0Emq5_KGvLN2WSDnC4BQiSTC@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | Maciek Sakrejda | 2011-02-02 20:32:37 | Re: Slow statement when using JDBC |
Previous Message | Hugo Garza | 2011-02-02 17:03:08 | Re: My query table aliases don't exist in my application |