Frédérik Bilhaut wrote:
> Hi everybody,
>
> I am experiencing a *very* strange problem when querying Postgres
> through JDBC using PreparedStatements.
>
> To say it short, for the same SELECT query :
>
> - when reusing a single PreparedStatement the average response time per
> query is 60 milliseconds
>
> - when creating (and closing) a new PreparedStatement each time, the
> average response time drops to only 2 milliseconds !
Try with prepareThreshold=0. Probably, your particular query benefits
from re-planning each time with the particular concrete parameter values
for each execution.
(you can either specify this as a URL parameter, or tweak it on a
per-connection or per-statement basis via methods on
PGConnection/PGStatement)
-O