Vacuum, statistics, & trigger/procedure query plan caching - Mailing list pgsql-general

From Karl O. Pinc
Subject Vacuum, statistics, & trigger/procedure query plan caching
Date
Msg-id 1112627729l.25286l.0l@mofo
Whole thread Raw
List pgsql-general
Hi,

IIRC I once figured out that, for triggers at least,
query plans are cached with the connection.
This means that vacuuming and thus alterations
in the statistics do not take effect until
a connection is broken and re-established.

Mostly.  At least for triggers.  I think.
(In 7.4?)

I can't seem to find documentation on the
caching of query plans.  And in any case
it would be nice to have that information
linked to from the "periodic database maintenance
tasks" page that explains vacuuming.

Would it be possible/sensible to put a timestamp
on the cached query plans and compare that with
a timestamp on the last vacuum of the relevant
tables so that the query plans can be regenerated
if done from out of date statistics?
(Might that make it possible to plan queries less
often by disassociating the trigger query plan cache
from the connection?)

Out of date query plans don't often matter
but when they do they matter a lot.

Regards,

Karl <kop@meme.com>
Free Software:  "You don't pay back, you pay forward."
                 -- Robert A. Heinlein



pgsql-general by date:

Previous
From: Wes
Date:
Subject: Re: Vacuum time degrading
Next
From: Tom Lane
Date:
Subject: Re: Vacuum time degrading