Re: How to restore a Plan from a stored plan text? - Mailing list pgsql-general

From Tom Lane
Subject Re: How to restore a Plan from a stored plan text?
Date
Msg-id 16541.1283616618@sss.pgh.pa.us
Whole thread Raw
In response to Re: How to restore a Plan from a stored plan text?  (sunpeng <bluevaley@gmail.com>)
List pgsql-general
sunpeng <bluevaley@gmail.com> writes:
> Thanks for your help!The motivation is that I try to find the most used sub
> plan ,and cach the sub plan's execution result and  store sub plan itself on
> disk. Even the sub plan's connection is closed, the consequent connection
> with the same sub plan could utilize the stored cached result.

This is not particularly a good idea, at least not without a whole lot
of *other* infrastructure.  How will you know if the plan has been
obsoleted by table changes?  Even without considering that, how will you
know when the cached result is obsoleted by data changes?

You might want to consult the PG archives for previous discussions about
shared plan caches.  I think the previous proposals involved keeping
things in shared memory not on disk, but they otherwise had many of the
same problems as this.  There have also been periodic discussions about
caching function execution results, which also seems closely related.

            regards, tom lane

pgsql-general by date:

Previous
From: Devrim GÜNDÜZ
Date:
Subject: Re: On-disk size of db increased after restore
Next
From: Julia Jacobson
Date:
Subject: psql '\copy' command for writing binary data from BYTEA column to file