From: Tom Lane <tgl@sss.pgh.pa.us>
To: Jan Wieck <JanWieck@Yahoo.com>
Cc: ivan <iv@psycho.pl>
Cc: pgsql-hackers@postgresql.org
Subject: Re: cache in plpgsql
Date: Thu, 01 Jan 2004 22:25:20 -0500
Message-ID: <2714.1073013920@sss.pgh.pa.us> (raw)
In-Reply-To: <3FF4DC86.1000400@Yahoo.com>
References: <Pine.LNX.4.56.0312302329590.5131@rex.anfa.pl>
<3FF2C608.3090906@Yahoo.com>
<Pine.LNX.4.56.0312311417500.20780@rex.anfa.pl>
<3FF2CFE0.70804@Yahoo.com>
<Pine.LNX.4.56.0401011655420.13912@rex.anfa.pl>
<3FF4DC86.1000400@Yahoo.com>
Jan Wieck <JanWieck@Yahoo.com> writes:
> But can you tell me how to actually check if a saved SPI plan
> references that particular catalog object or not?
This is certainly doable in principle. recordDependencyOnExpr()
contains much of the logic that would be needed -- it would need to be
modified so that the dependency info can just be put in memory and not
stored into pg_depend, but that's surely not hard. (Note that to use
it directly, we'd want to examine the parsed querytree not the plan
tree, but that isn't a problem AFAICS.)
Whether it's *practical* is another question. Cache inval events
happen often enough that speed of response to 'em is an issue.
Maybe we could use a hashtable of dependencies to avoid expensive
searches for cached plans that must be invalidated.
Another little problem is that plpgsql doesn't really have any mechanism
for invalidating cached stuff at all; it will leak memory like there's
no tomorrow if we start dropping cached subplans. plpgsql needs to be
rewritten so that everything it allocates lives in per-function memory
contexts that can be dropped when an invalidation happens.
As far as I can see a dependency-based solution is possible. It's
just a Small Matter Of Programming.
http://www.catb.org/~esr/jargon/html/S/SMOP.html
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: tgl@sss.pgh.pa.us, JanWieck@Yahoo.com, iv@psycho.pl
Subject: Re: cache in plpgsql
In-Reply-To: <2714.1073013920@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox