Re: Under what circumstances does PreparedStatement use stored plans?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: James Robinson <jlrobins(at)socialserve(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Under what circumstances does PreparedStatement use stored plans?
Date: 2004-04-13 18:42:40
Message-ID: 25164.1081881760@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

James Robinson <jlrobins(at)socialserve(dot)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

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message James Robinson 2004-04-13 19:19:28 Re: Under what circumstances does PreparedStatement use stored plans?
Previous Message James Robinson 2004-04-13 18:36:30 Re: Under what circumstances does PreparedStatement use stored plans?