Hi,
I am trying to use Explain Analyze to trace a slow SQL statement called from
JDBC.
The SQL statement with the parameters taked 11 seconds. When I run a explain
analyze from psql, it takes < 50 ms with a reasonable explain plan. However
when I try to run an explain analyze from JDBC with the parameters, I get
error :
ERROR: no value found for parameter 1
Here is sample code which causes this exception ...
pst=prodconn.prepareStatement("explain analyze select count(*) from
jam_heaprel r where heap_id = ? and parentaddr = ?");
pst.setInt(1,1);
pst.setInt(2,0);
rs=pst.executeQuery();
java.sql.SQLException: ERROR: no value found for parameter 1
at
org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1471)
at
org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1256)
at
org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:175)
at
org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:389)
at
org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:330)
at
org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:240)
at jsp._testexplain_2ejsp._jspService(_testexplain_2ejsp.java:82)
at org.gjt.jsp.HttpJspPageImpl.service(HttpJspPageImpl.java:75)
Regards,
Virag