diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2011-09-16 00:42:53 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2011-09-16 00:43:52 -0400 |
commit | e6faf910d75027bdce7cd0f2033db4e912592bcc (patch) | |
tree | b5fdc2340cc1cdf27dd473e23a09cb2953b5053c /src/include/executor/spi.h | |
parent | 09e98a3e170ecdeb25a0e1afe81bdbeeeaf21f48 (diff) | |
download | postgresql-e6faf910d75027bdce7cd0f2033db4e912592bcc.tar.gz postgresql-e6faf910d75027bdce7cd0f2033db4e912592bcc.zip |
Redesign the plancache mechanism for more flexibility and efficiency.
Rewrite plancache.c so that a "cached plan" (which is rather a misnomer
at this point) can support generation of custom, parameter-value-dependent
plans, and can make an intelligent choice between using custom plans and
the traditional generic-plan approach. The specific choice algorithm
implemented here can probably be improved in future, but this commit is
all about getting the mechanism in place, not the policy.
In addition, restructure the API to greatly reduce the amount of extraneous
data copying needed. The main compromise needed to make that possible was
to split the initial creation of a CachedPlanSource into two steps. It's
worth noting in particular that SPI_saveplan is now deprecated in favor of
SPI_keepplan, which accomplishes the same end result with zero data
copying, and no need to then spend even more cycles throwing away the
original SPIPlan. The risk of long-term memory leaks while manipulating
SPIPlans has also been greatly reduced. Most of this improvement is based
on use of the recently-added MemoryContextSetParent primitive.
Diffstat (limited to 'src/include/executor/spi.h')
-rw-r--r-- | src/include/executor/spi.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/include/executor/spi.h b/src/include/executor/spi.h index 7199debb27a..3b1b27ee49e 100644 --- a/src/include/executor/spi.h +++ b/src/include/executor/spi.h @@ -93,6 +93,7 @@ extern SPIPlanPtr SPI_prepare_params(const char *src, ParserSetupHook parserSetup, void *parserSetupArg, int cursorOptions); +extern int SPI_keepplan(SPIPlanPtr plan); extern SPIPlanPtr SPI_saveplan(SPIPlanPtr plan); extern int SPI_freeplan(SPIPlanPtr plan); |