summaryrefslogtreecommitdiff
path: root/src/backend/nodes
diff options
context:
space:
mode:
authorTom Lane2000-12-14 22:30:45 +0000
committerTom Lane2000-12-14 22:30:45 +0000
commitea166f11462c863d91378fcbb15d4d3140002413 (patch)
treeef157dad5b07081aae231ab9691f2ef2d5b625a4 /src/backend/nodes
parentdb11f4382abad09d42e784c1fa19dfbcd68038ac (diff)
Planner speedup hacking. Avoid saving useless pathkeys, so that path
comparison does not consider paths different when they differ only in uninteresting aspects of sort order. (We had a special case of this consideration for indexscans already, but generalize it to apply to ordered join paths too.) Be stricter about what is a canonical pathkey to allow faster pathkey comparison. Cache canonical pathkeys and dispersion stats for left and right sides of a RestrictInfo's clause, to avoid repeated computation. Total speedup will depend on number of tables in a query, but I see about 4x speedup of planning phase for a sample seven-table query.
Diffstat (limited to 'src/backend/nodes')
-rw-r--r--src/backend/nodes/copyfuncs.c7
-rw-r--r--src/backend/nodes/equalfuncs.c7
-rw-r--r--src/backend/nodes/readfuncs.c7
3 files changed, 16 insertions, 5 deletions
diff --git a/src/backend/nodes/copyfuncs.c b/src/backend/nodes/copyfuncs.c
index 3e4a6d91dd1..62ce708f0bb 100644
--- a/src/backend/nodes/copyfuncs.c
+++ b/src/backend/nodes/copyfuncs.c
@@ -15,7 +15,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.134 2000/12/12 23:33:32 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.135 2000/12/14 22:30:42 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -1424,7 +1424,12 @@ _copyRestrictInfo(RestrictInfo *from)
newnode->mergejoinoperator = from->mergejoinoperator;
newnode->left_sortop = from->left_sortop;
newnode->right_sortop = from->right_sortop;
+ /* Do not copy pathkeys, since they'd not be canonical in a copied query */
+ newnode->left_pathkey = NIL;
+ newnode->right_pathkey = NIL;
newnode->hashjoinoperator = from->hashjoinoperator;
+ newnode->left_dispersion = from->left_dispersion;
+ newnode->right_dispersion = from->right_dispersion;
return newnode;
}
diff --git a/src/backend/nodes/equalfuncs.c b/src/backend/nodes/equalfuncs.c
index 2f6a93b95ba..645fc56e3f8 100644
--- a/src/backend/nodes/equalfuncs.c
+++ b/src/backend/nodes/equalfuncs.c
@@ -20,7 +20,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/nodes/equalfuncs.c,v 1.84 2000/12/12 23:33:33 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/nodes/equalfuncs.c,v 1.85 2000/12/14 22:30:42 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -515,8 +515,9 @@ _equalRestrictInfo(RestrictInfo *a, RestrictInfo *b)
if (!equal(a->clause, b->clause))
return false;
/*
- * ignore eval_cost, since it may not be set yet, and should be
- * derivable from the clause anyway
+ * ignore eval_cost, left/right_pathkey, and left/right_dispersion,
+ * since they may not be set yet, and should be derivable from the
+ * clause anyway
*/
if (a->ispusheddown != b->ispusheddown)
return false;
diff --git a/src/backend/nodes/readfuncs.c b/src/backend/nodes/readfuncs.c
index d8aa2a5d2dc..4d4ec782e7a 100644
--- a/src/backend/nodes/readfuncs.c
+++ b/src/backend/nodes/readfuncs.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.101 2000/12/12 23:33:33 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.102 2000/12/14 22:30:42 tgl Exp $
*
* NOTES
* Most of the read functions for plan nodes are tested. (In fact, they
@@ -1848,6 +1848,11 @@ _readRestrictInfo(void)
/* eval_cost is not part of saved representation; compute on first use */
local_node->eval_cost = -1;
+ /* ditto for cached pathkeys and dispersion */
+ local_node->left_pathkey = NIL;
+ local_node->right_pathkey = NIL;
+ local_node->left_dispersion = -1;
+ local_node->right_dispersion = -1;
return local_node;
}