git.postgresql.org Git - postgresql.git/commitdiff

git projects / postgresql.git / commitdiff
? search:
summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ecaa2e0)
Tweak memory context sizing for saved SPI plans.
Thu, 2 Aug 2001 16:05:23 +0000 (16:05 +0000)
Thu, 2 Aug 2001 16:05:23 +0000 (16:05 +0000)

diff --git a/src/backend/executor/spi.c b/src/backend/executor/spi.c
index b5fef1dd49ce1065b5d74df55352225f8a7ca992..7b4030d580a58cb6379559eff70c015d97d99342 100644 (file)
--- a/src/backend/executor/spi.c
+++ b/src/backend/executor/spi.c
@@ -3,13 +3,21 @@
* spi.c
* Server Programming Interface
*
- * $Header: /cvsroot/pgsql/src/backend/executor/spi.c,v 1.55 2001年06月01日 19:43:55 tgl Exp $
+ * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ *
+ * IDENTIFICATION
+ * $Header: /cvsroot/pgsql/src/backend/executor/spi.c,v 1.56 2001年08月02日 16:05:23 tgl Exp $
*
*-------------------------------------------------------------------------
*/
-#include "executor/spi_priv.h"
+#include "postgres.h"
+
#include "access/printtup.h"
#include "commands/command.h"
+#include "executor/spi_priv.h"
+
uint32 SPI_processed = 0;
Oid SPI_lastoid = InvalidOid;
@@ -786,10 +794,10 @@ spi_printtup(HeapTuple tuple, TupleDesc tupdesc, DestReceiver *self)
if (tuptable == NULL)
{
tuptabcxt = AllocSetContextCreate(CurrentMemoryContext,
- "SPI TupTable",
- ALLOCSET_DEFAULT_MINSIZE,
- ALLOCSET_DEFAULT_INITSIZE,
- ALLOCSET_DEFAULT_MAXSIZE);
+ "SPI TupTable",
+ ALLOCSET_DEFAULT_MINSIZE,
+ ALLOCSET_DEFAULT_INITSIZE,
+ ALLOCSET_DEFAULT_MAXSIZE);
MemoryContextSwitchTo(tuptabcxt);
_SPI_current->tuptable = tuptable = (SPITupleTable *)
@@ -1253,29 +1261,28 @@ _SPI_copy_plan(_SPI_plan *plan, int location)
_SPI_plan *newplan;
MemoryContext oldcxt;
MemoryContext plancxt;
- MemoryContext parentcxt = CurrentMemoryContext;
+ MemoryContext parentcxt;
- /* Determine correct parent for the plans memory context */
+ /* Determine correct parent for the plan's memory context */
if (location == _SPI_CPLAN_PROCXT)
parentcxt = _SPI_current->procCxt;
- /*
- oldcxt = MemoryContextSwitchTo(_SPI_current->procCxt);
- */
else if (location == _SPI_CPLAN_TOPCXT)
parentcxt = TopMemoryContext;
- /*
- oldcxt = MemoryContextSwitchTo(TopMemoryContext);
- */
+ else
+ parentcxt = CurrentMemoryContext;
- /* Create a memory context for the plan */
+ /*
+ * Create a memory context for the plan. We don't expect the plan to
+ * be very large, so use smaller-than-default alloc parameters.
+ */
plancxt = AllocSetContextCreate(parentcxt,
- "SPI Plan",
- ALLOCSET_DEFAULT_MINSIZE,
- ALLOCSET_DEFAULT_INITSIZE,
- ALLOCSET_DEFAULT_MAXSIZE);
+ "SPI Plan",
+ 1024,
+ 1024,
+ ALLOCSET_DEFAULT_MAXSIZE);
oldcxt = MemoryContextSwitchTo(plancxt);
- /* Copy the SPI plan into it's own context */
+ /* Copy the SPI plan into its own context */
newplan = (_SPI_plan *) palloc(sizeof(_SPI_plan));
newplan->plancxt = plancxt;
newplan->qtlist = (List *) copyObject(plan->qtlist);
This is the main PostgreSQL git repository.
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /