Re: Under what circumstances does PreparedStatement use stored plans? - Mailing list pgsql-jdbc

From Tom Lane
Subject Re: Under what circumstances does PreparedStatement use stored plans?
Date
Msg-id 25164.1081881760@sss.pgh.pa.us
Whole thread Raw
In response to Re: Under what circumstances does PreparedStatement use stored plans?  (James Robinson <jlrobins@socialserve.com>)
Responses Re: Under what circumstances does PreparedStatement use stored
List pgsql-jdbc
James Robinson <jlrobins@socialserve.com> writes:
> ... I suppose this all assumes that the lookup + maintenance of such a
> datastructure would ultimately cost less than re-planning all queries
> all the time.

I think that is a safe bet to be true, as long as you get *some* mileage
out of the plan cache.  If the application issues a bunch of
no-two-alike queries then it's a loss of course.  But doesn't the JDBC
API distinguish prepared statements from unprepared ones?  ISTM it is
the app programmer's responsibility to prepare just those statements
he's likely to use more than once.  I don't think the driver need
second-guess this choice.

            regards, tom lane

pgsql-jdbc by date:

Previous
From: James Robinson
Date:
Subject: Re: Under what circumstances does PreparedStatement use stored plans?
Next
From: James Robinson
Date:
Subject: Re: Under what circumstances does PreparedStatement use stored plans?