From cb02610e503957d7ed9b4375537fb6275c16f1fa Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Sun, 15 Jun 2003 22:51:45 +0000 Subject: Adjust nestloop-with-inner-indexscan plan generation so that we catch some cases of redundant clauses that were formerly not caught. We have to special-case this because the clauses involved never get attached to the same join restrictlist and so the existing logic does not notice that they are redundant. --- src/backend/nodes/list.c | 17 ++++++++++++++++- src/backend/nodes/outfuncs.c | 6 +++++- 2 files changed, 21 insertions(+), 2 deletions(-) (limited to 'src/backend/nodes') diff --git a/src/backend/nodes/list.c b/src/backend/nodes/list.c index 207acea9472..7467e1a00e1 100644 --- a/src/backend/nodes/list.c +++ b/src/backend/nodes/list.c @@ -9,7 +9,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/nodes/list.c,v 1.49 2003/05/28 22:32:49 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/nodes/list.c,v 1.50 2003/06/15 22:51:45 tgl Exp $ * * NOTES * XXX a few of the following functions are duplicated to handle @@ -358,6 +358,21 @@ llast(List *l) return lfirst(l); } +/* + * llastnode + * + * Get the last node of l ... NIL if empty list + */ +List * +llastnode(List *l) +{ + if (l == NIL) + return NIL; + while (lnext(l) != NIL) + l = lnext(l); + return l; +} + /* * freeList * diff --git a/src/backend/nodes/outfuncs.c b/src/backend/nodes/outfuncs.c index cec7f09f0a9..f042e8a8d21 100644 --- a/src/backend/nodes/outfuncs.c +++ b/src/backend/nodes/outfuncs.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.207 2003/06/06 15:04:02 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.208 2003/06/15 22:51:45 tgl Exp $ * * NOTES * Every node type that can appear in stored rules' parsetrees *must* @@ -933,6 +933,7 @@ _outIndexPath(StringInfo str, IndexPath *node) WRITE_NODE_FIELD(indexinfo); WRITE_NODE_FIELD(indexqual); + WRITE_NODE_FIELD(indexjoinclauses); WRITE_ENUM_FIELD(indexscandir, ScanDirection); WRITE_FLOAT_FIELD(rows, "%.2f"); } @@ -1034,6 +1035,7 @@ _outRestrictInfo(StringInfo str, RestrictInfo *node) { WRITE_NODE_TYPE("RESTRICTINFO"); + /* NB: this isn't a complete set of fields */ WRITE_NODE_FIELD(clause); WRITE_BOOL_FIELD(ispusheddown); WRITE_NODE_FIELD(subclauseindices); @@ -1042,6 +1044,8 @@ _outRestrictInfo(StringInfo str, RestrictInfo *node) WRITE_OID_FIELD(mergejoinoperator); WRITE_OID_FIELD(left_sortop); WRITE_OID_FIELD(right_sortop); + WRITE_NODE_FIELD(left_pathkey); + WRITE_NODE_FIELD(right_pathkey); WRITE_OID_FIELD(hashjoinoperator); } -- cgit v1.2.3