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