summaryrefslogtreecommitdiff
path: root/src/include/nodes
diff options
context:
space:
mode:
authorTom Lane2008-09-09 18:58:09 +0000
committerTom Lane2008-09-09 18:58:09 +0000
commitee33b95d9c2ecec170bc517783d7268a4bd0c793 (patch)
tree9012453a44799d20b15b2e4dcb1fb5e6784e2a7e /src/include/nodes
parentc06629c72e7e3d435e207c2f80de3aa8a97c1d04 (diff)
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.
Diffstat (limited to 'src/include/nodes')
-rw-r--r--src/include/nodes/nodes.h4
-rw-r--r--src/include/nodes/plannodes.h22
-rw-r--r--src/include/nodes/relation.h4
3 files changed, 27 insertions, 3 deletions
diff --git a/src/include/nodes/nodes.h b/src/include/nodes/nodes.h
index 7e3d67a241f..c02b4c17904 100644
--- a/src/include/nodes/nodes.h
+++ b/src/include/nodes/nodes.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/nodes/nodes.h,v 1.211 2008/08/30 01:39:14 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/nodes/nodes.h,v 1.212 2008/09/09 18:58:08 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -67,6 +67,8 @@ typedef enum NodeTag
T_Hash,
T_SetOp,
T_Limit,
+ /* this one isn't a subclass of Plan: */
+ T_PlanInvalItem,
/*
* TAGS FOR PLAN STATE NODES (execnodes.h)
diff --git a/src/include/nodes/plannodes.h b/src/include/nodes/plannodes.h
index f0e0d08e03a..2f0ed9a5d79 100644
--- a/src/include/nodes/plannodes.h
+++ b/src/include/nodes/plannodes.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/nodes/plannodes.h,v 1.102 2008/08/07 19:35:02 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/nodes/plannodes.h,v 1.103 2008/09/09 18:58:08 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -17,6 +17,7 @@
#include "access/sdir.h"
#include "nodes/bitmapset.h"
#include "nodes/primnodes.h"
+#include "storage/itemptr.h"
/* ----------------------------------------------------------------
@@ -72,6 +73,8 @@ typedef struct PlannedStmt
List *relationOids; /* OIDs of relations the plan depends on */
+ List *invalItems; /* other dependencies, as PlanInvalItems */
+
int nParamExec; /* number of PARAM_EXEC Params used */
} PlannedStmt;
@@ -559,4 +562,21 @@ typedef struct Limit
Node *limitCount; /* COUNT parameter, or NULL if none */
} Limit;
+
+/*
+ * Plan invalidation info
+ *
+ * We track the objects on which a PlannedStmt depends in two ways:
+ * relations are recorded as a simple list of OIDs, and everything else
+ * is represented as a list of PlanInvalItems. A PlanInvalItem is designed
+ * to be used with the syscache invalidation mechanism, so it identifies a
+ * system catalog entry by cache ID and tuple TID.
+ */
+typedef struct PlanInvalItem
+{
+ NodeTag type;
+ int cacheId; /* a syscache ID, see utils/syscache.h */
+ ItemPointerData tupleId; /* TID of the object's catalog tuple */
+} PlanInvalItem;
+
#endif /* PLANNODES_H */
diff --git a/src/include/nodes/relation.h b/src/include/nodes/relation.h
index 8fb6861e50c..c66bc05a749 100644
--- a/src/include/nodes/relation.h
+++ b/src/include/nodes/relation.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/nodes/relation.h,v 1.158 2008/08/14 18:48:00 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/nodes/relation.h,v 1.159 2008/09/09 18:58:08 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -74,6 +74,8 @@ typedef struct PlannerGlobal
List *relationOids; /* OIDs of relations the plan depends on */
+ List *invalItems; /* other dependencies, as PlanInvalItems */
+
bool transientPlan; /* redo plan when TransactionXmin changes? */
} PlannerGlobal;