Skip site navigation (1) Skip section navigation (2)

Re: invalidating cached plans

From: "Qingqing Zhou" <zhouqq(at)cs(dot)toronto(dot)edu>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: invalidating cached plans
Date: 2005-04-02 07:19:17
Message-ID: d2lh5d$531$1@news.hub.org (view raw or flat)
Thread:
Lists: pgsql-hackers
"Neil Conway" <neilc(at)samurai(dot)com> 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
simplicity;
(3) discard the cache result is the target relation is updated in the same
transaction;
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.

Regards,
Qingqing



In response to

Responses

pgsql-hackers by date

Next:From: Peter EisentrautDate: 2005-04-02 07:46:50
Subject: Re: [GENERAL] plPHP in core?
Previous:From: Tom LaneDate: 2005-04-02 06:31:13
Subject: Re: [HACKERS] plPHP in core?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group