Re: invalidating cached plans - Mailing list pgsql-hackers

From Qingqing Zhou
Subject Re: invalidating cached plans
Msg-id d2lh5d$531$
Whole thread Raw
In response to invalidating cached plans  (Neil Conway)
Responses Re: invalidating cached plans  (Tom Lane)
List pgsql-hackers
"Neil Conway" <> writes
> PostgreSQL should invalidate a cached query plan when one of the objects
> the plan depends upon is modified.

It just comes into my mind that current cache invalidation implementation
may need to consider the future query result cache.

The question comes like this: for a simple query (i.e., the query without
any function call, on a single relation, etc),  the result cache is not very
difficult to do in my understanding, the sketch is here:
(1) result set is only valid for queries within a serializable transaction;
(2) result set is reusable if the whole where-condition is matched - for
(3) discard the cache result is the target relation is updated in the same
We cache ctids or the real tuples. And we develop a new scan method, say
T_ResultSetScan on the result set.

A problem is araised if the where-condition include a function. Two queries
looks the same, but the function they called might be different at this time
... the cached plans invalidation mechanism could help to detect this.


pgsql-hackers by date:

From: Tom Lane
Subject: Re: [GENERAL] plPHP in core?
From: Peter Eisentraut
Subject: Re: [GENERAL] plPHP in core?