Re: Slow statement when using JDBC

From: Maciek Sakrejda <msakrejda(at)truviso(dot)com>
To: Kevin Grittner <Kevin(dot)Grittner(at)wicourts(dot)gov>
Cc: yazan(dot)suleiman(at)gmail(dot)com, pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Slow statement when using JDBC
Date: 2011-02-02 21:59:49
Message-ID: AANLkTinBYdnJmxKnPuADiWhbw2AFKqkQTdrdLDUf8j1z@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message yazan suleiman 2011-02-02 22:11:20 Re: Slow statement when using JDBC
Previous Message Kevin Grittner 2011-02-02 21:49:42 Re: Slow statement when using JDBC