1
0
mirror of https://github.com/postgres/postgres.git synced 2025-08-31 17:02:12 +03:00

Improve the plan cache invalidation mechanism to make it invalidate plans

when user-defined functions used in a plan are modified.  Also invalidate
plans when schemas, operators, or operator classes are modified; but for these
cases we just invalidate everything rather than tracking exact dependencies,
since these types of objects seldom change in a production database.

Tom Lane; loosely based on a patch by Martin Pihlak.
This commit is contained in:
Tom Lane
2008-09-09 18:58:09 +00:00
parent c06629c72e
commit ee33b95d9c
18 changed files with 522 additions and 275 deletions

View File

@@ -15,7 +15,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/nodes/copyfuncs.c,v 1.404 2008/09/01 20:42:44 tgl Exp $
* $PostgreSQL: pgsql/src/backend/nodes/copyfuncs.c,v 1.405 2008/09/09 18:58:08 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -88,6 +88,7 @@ _copyPlannedStmt(PlannedStmt *from)
COPY_NODE_FIELD(returningLists);
COPY_NODE_FIELD(rowMarks);
COPY_NODE_FIELD(relationOids);
COPY_NODE_FIELD(invalItems);
COPY_SCALAR_FIELD(nParamExec);
return newnode;
@@ -689,6 +690,21 @@ _copyLimit(Limit *from)
return newnode;
}
/*
* _copyPlanInvalItem
*/
static PlanInvalItem *
_copyPlanInvalItem(PlanInvalItem *from)
{
PlanInvalItem *newnode = makeNode(PlanInvalItem);
COPY_SCALAR_FIELD(cacheId);
/* tupleId isn't really a "scalar", but this works anyway */
COPY_SCALAR_FIELD(tupleId);
return newnode;
}
/* ****************************************************************
* primnodes.h copy functions
* ****************************************************************
@@ -3157,6 +3173,9 @@ copyObject(void *from)
case T_Limit:
retval = _copyLimit(from);
break;
case T_PlanInvalItem:
retval = _copyPlanInvalItem(from);
break;
/*
* PRIMITIVE NODES