mirror of
https://github.com/postgres/postgres.git
synced 2025-07-28 23:42:10 +03:00
Simplify the planner's join clause management by storing join clauses
of a relation in a flat 'joininfo' list. The former arrangement grouped the join clauses according to the set of unjoined relids used in each; however, profiling on test cases involving lots of joins proves that that data structure is a net loss. It takes more time to group the join clauses together than is saved by avoiding duplicate tests later. It doesn't help any that there are usually not more than one or two clauses per group ...
This commit is contained in:
@ -15,7 +15,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/nodes/copyfuncs.c,v 1.305 2005/06/05 22:32:54 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/nodes/copyfuncs.c,v 1.306 2005/06/09 04:18:58 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -1237,6 +1237,7 @@ _copyRestrictInfo(RestrictInfo *from)
|
||||
COPY_SCALAR_FIELD(valid_everywhere);
|
||||
COPY_SCALAR_FIELD(can_join);
|
||||
COPY_BITMAPSET_FIELD(clause_relids);
|
||||
COPY_BITMAPSET_FIELD(required_relids);
|
||||
COPY_BITMAPSET_FIELD(left_relids);
|
||||
COPY_BITMAPSET_FIELD(right_relids);
|
||||
COPY_NODE_FIELD(orclause);
|
||||
@ -1262,20 +1263,6 @@ _copyRestrictInfo(RestrictInfo *from)
|
||||
return newnode;
|
||||
}
|
||||
|
||||
/*
|
||||
* _copyJoinInfo
|
||||
*/
|
||||
static JoinInfo *
|
||||
_copyJoinInfo(JoinInfo *from)
|
||||
{
|
||||
JoinInfo *newnode = makeNode(JoinInfo);
|
||||
|
||||
COPY_BITMAPSET_FIELD(unjoined_relids);
|
||||
COPY_NODE_FIELD(jinfo_restrictinfo);
|
||||
|
||||
return newnode;
|
||||
}
|
||||
|
||||
/*
|
||||
* _copyInClauseInfo
|
||||
*/
|
||||
@ -2857,9 +2844,6 @@ copyObject(void *from)
|
||||
case T_RestrictInfo:
|
||||
retval = _copyRestrictInfo(from);
|
||||
break;
|
||||
case T_JoinInfo:
|
||||
retval = _copyJoinInfo(from);
|
||||
break;
|
||||
case T_InClauseInfo:
|
||||
retval = _copyInClauseInfo(from);
|
||||
break;
|
||||
|
@ -18,7 +18,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/nodes/equalfuncs.c,v 1.242 2005/06/05 22:32:54 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/nodes/equalfuncs.c,v 1.243 2005/06/09 04:18:58 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -594,6 +594,7 @@ _equalRestrictInfo(RestrictInfo *a, RestrictInfo *b)
|
||||
COMPARE_NODE_FIELD(clause);
|
||||
COMPARE_SCALAR_FIELD(is_pushed_down);
|
||||
COMPARE_SCALAR_FIELD(valid_everywhere);
|
||||
COMPARE_BITMAPSET_FIELD(required_relids);
|
||||
|
||||
/*
|
||||
* We ignore all the remaining fields, since they may not be set yet,
|
||||
@ -603,15 +604,6 @@ _equalRestrictInfo(RestrictInfo *a, RestrictInfo *b)
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
_equalJoinInfo(JoinInfo *a, JoinInfo *b)
|
||||
{
|
||||
COMPARE_BITMAPSET_FIELD(unjoined_relids);
|
||||
COMPARE_NODE_FIELD(jinfo_restrictinfo);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
_equalInClauseInfo(InClauseInfo *a, InClauseInfo *b)
|
||||
{
|
||||
@ -1915,9 +1907,6 @@ equal(void *a, void *b)
|
||||
case T_RestrictInfo:
|
||||
retval = _equalRestrictInfo(a, b);
|
||||
break;
|
||||
case T_JoinInfo:
|
||||
retval = _equalJoinInfo(a, b);
|
||||
break;
|
||||
case T_InClauseInfo:
|
||||
retval = _equalInClauseInfo(a, b);
|
||||
break;
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/nodes/outfuncs.c,v 1.254 2005/06/06 04:13:35 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/nodes/outfuncs.c,v 1.255 2005/06/09 04:18:58 tgl Exp $
|
||||
*
|
||||
* NOTES
|
||||
* Every node type that can appear in stored rules' parsetrees *must*
|
||||
@ -1227,6 +1227,7 @@ _outRestrictInfo(StringInfo str, RestrictInfo *node)
|
||||
WRITE_BOOL_FIELD(valid_everywhere);
|
||||
WRITE_BOOL_FIELD(can_join);
|
||||
WRITE_BITMAPSET_FIELD(clause_relids);
|
||||
WRITE_BITMAPSET_FIELD(required_relids);
|
||||
WRITE_BITMAPSET_FIELD(left_relids);
|
||||
WRITE_BITMAPSET_FIELD(right_relids);
|
||||
WRITE_NODE_FIELD(orclause);
|
||||
@ -1238,15 +1239,6 @@ _outRestrictInfo(StringInfo str, RestrictInfo *node)
|
||||
WRITE_OID_FIELD(hashjoinoperator);
|
||||
}
|
||||
|
||||
static void
|
||||
_outJoinInfo(StringInfo str, JoinInfo *node)
|
||||
{
|
||||
WRITE_NODE_TYPE("JOININFO");
|
||||
|
||||
WRITE_BITMAPSET_FIELD(unjoined_relids);
|
||||
WRITE_NODE_FIELD(jinfo_restrictinfo);
|
||||
}
|
||||
|
||||
static void
|
||||
_outInnerIndexscanInfo(StringInfo str, InnerIndexscanInfo *node)
|
||||
{
|
||||
@ -1989,9 +1981,6 @@ _outNode(StringInfo str, void *obj)
|
||||
case T_RestrictInfo:
|
||||
_outRestrictInfo(str, obj);
|
||||
break;
|
||||
case T_JoinInfo:
|
||||
_outJoinInfo(str, obj);
|
||||
break;
|
||||
case T_InnerIndexscanInfo:
|
||||
_outInnerIndexscanInfo(str, obj);
|
||||
break;
|
||||
|
Reference in New Issue
Block a user