Re: How to restore a Plan from a stored plan text?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: sunpeng <bluevaley(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: How to restore a Plan from a stored plan text?
Date: 2010-09-04 16:10:18
Message-ID: 16541.1283616618@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

sunpeng <bluevaley(at)gmail(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Julia Jacobson 2010-09-04 16:24:36 psql '\copy' command for writing binary data from BYTEA column to file
Previous Message yj2133011 2010-09-04 14:59:24 Re: On-disk size of db increased after restore