Re: Slow statement when using JDBC - Mailing list pgsql-jdbc

From Maciek Sakrejda
Subject Re: Slow statement when using JDBC
Date
Msg-id AANLkTinBYdnJmxKnPuADiWhbw2AFKqkQTdrdLDUf8j1z@mail.gmail.com
Whole thread Raw
In response to Re: Slow statement when using JDBC  ("Kevin Grittner" <Kevin.Grittner@wicourts.gov>)
Responses Re: Slow statement when using JDBC  (yazan suleiman <yazan.suleiman@gmail.com>)
List pgsql-jdbc
> For queries like this, you want to be sure that the query is planned
> each time based on the actual value.

Which I think *is* the case until you hit prepareThreshold in JDBC,
no? This has come up on the list before, and as long as you're using
an unnamed server-side prepared statement, the planner will wait to
plan it until it has the actual parameters available. That's why the
planning savings of having the JDBC driver "upgrade" you to named
statements after a few executions can come back to bite you: a
parameter-agnostic plan will often be *much* costlier than re-planning
every single time.

However, since Yazan is seeing this right off the bat (and not after a
certain number of executions), I'm suspicious. It'd be nice to see
what's happening here at the protocol level. Yazan, can you configure
driver-level logging through the loglevel connection param and
DriverManager.setLogWriter()?

---
Maciek Sakrejda | System Architect | Truviso

1065 E. Hillsdale Blvd., Suite 215
Foster City, CA 94404
www.truviso.com

pgsql-jdbc by date:

Previous
From: "Kevin Grittner"
Date:
Subject: Re: Slow statement when using JDBC
Next
From: yazan suleiman
Date:
Subject: Re: Slow statement when using JDBC