Re: Query preparation - Mailing list pgsql-jdbc

From Tom Lane
Subject Re: Query preparation
Date
Msg-id 10718.1239808274@sss.pgh.pa.us
Whole thread Raw
In response to Re: Query preparation  (Oliver Jowett <oliver@opencloud.com>)
Responses Re: Query preparation
List pgsql-jdbc
Oliver Jowett <oliver@opencloud.com> writes:
> Heikki Linnakangas wrote:
>> Does anyone see a problem with caching the result set descriptor
>> (RowDescription)? AFAICS it should never change after a statement is
>> prepared. If not, I'll polish up and submit the patch.

> If you tie it to the existing named statement mechanisms I think that
> works. We invalidate the named statement anyway if the parameter types
> change, and you want to invalidate any cached row description at the
> same time. Schema changes could bite you, but I think they bite named
> statements in other ways anyway. (Not sure how far the server-side
> efforts to do plan invalidation progressed)

It should be safe.  The server is set up to throw an error if you try to
re-use a prepared statement whose output tuple descriptor would have
changed due to schema changes.  So there's a backstop if the driver's
invalidation logic misses anything.

            regards, tom lane

pgsql-jdbc by date:

Previous
From: Oliver Jowett
Date:
Subject: Re: Query preparation
Next
From: bdbusch
Date:
Subject: Re: Deadlock detection