Desultory de-FastList-ification. RelOptInfo.reltargetlist is back to
being a plain List.
This commit is contained in:
parent
6c33054a0c
commit
80c6847cc5
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/backend/optimizer/path/allpaths.c,v 1.116 2004/05/30 23:40:28 neilc Exp $
|
* $PostgreSQL: pgsql/src/backend/optimizer/path/allpaths.c,v 1.117 2004/06/01 03:02:51 tgl Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -246,7 +246,6 @@ set_inherited_rel_pathlist(Query *root, RelOptInfo *rel,
|
|||||||
RangeTblEntry *childrte;
|
RangeTblEntry *childrte;
|
||||||
Oid childOID;
|
Oid childOID;
|
||||||
RelOptInfo *childrel;
|
RelOptInfo *childrel;
|
||||||
List *reltlist;
|
|
||||||
ListCell *parentvars;
|
ListCell *parentvars;
|
||||||
ListCell *childvars;
|
ListCell *childvars;
|
||||||
|
|
||||||
@ -268,14 +267,12 @@ set_inherited_rel_pathlist(Query *root, RelOptInfo *rel,
|
|||||||
* the individual tables. Also, we just zap attr_needed rather
|
* the individual tables. Also, we just zap attr_needed rather
|
||||||
* than trying to adjust it; it won't be looked at in the child.
|
* than trying to adjust it; it won't be looked at in the child.
|
||||||
*/
|
*/
|
||||||
reltlist = FastListValue(&rel->reltargetlist);
|
childrel->reltargetlist = (List *)
|
||||||
reltlist = (List *)
|
adjust_inherited_attrs((Node *) rel->reltargetlist,
|
||||||
adjust_inherited_attrs((Node *) reltlist,
|
|
||||||
parentRTindex,
|
parentRTindex,
|
||||||
parentOID,
|
parentOID,
|
||||||
childRTindex,
|
childRTindex,
|
||||||
childOID);
|
childOID);
|
||||||
FastListFromList(&childrel->reltargetlist, reltlist);
|
|
||||||
childrel->attr_needed = NULL;
|
childrel->attr_needed = NULL;
|
||||||
childrel->baserestrictinfo = (List *)
|
childrel->baserestrictinfo = (List *)
|
||||||
adjust_inherited_attrs((Node *) rel->baserestrictinfo,
|
adjust_inherited_attrs((Node *) rel->baserestrictinfo,
|
||||||
@ -300,8 +297,8 @@ set_inherited_rel_pathlist(Query *root, RelOptInfo *rel,
|
|||||||
if (childrel->width > rel->width)
|
if (childrel->width > rel->width)
|
||||||
rel->width = childrel->width;
|
rel->width = childrel->width;
|
||||||
|
|
||||||
childvars = list_head(FastListValue(&childrel->reltargetlist));
|
forboth(parentvars, rel->reltargetlist,
|
||||||
foreach(parentvars, FastListValue(&rel->reltargetlist))
|
childvars, childrel->reltargetlist)
|
||||||
{
|
{
|
||||||
Var *parentvar = (Var *) lfirst(parentvars);
|
Var *parentvar = (Var *) lfirst(parentvars);
|
||||||
Var *childvar = (Var *) lfirst(childvars);
|
Var *childvar = (Var *) lfirst(childvars);
|
||||||
@ -310,7 +307,6 @@ set_inherited_rel_pathlist(Query *root, RelOptInfo *rel,
|
|||||||
|
|
||||||
if (childrel->attr_widths[childndx] > rel->attr_widths[parentndx])
|
if (childrel->attr_widths[childndx] > rel->attr_widths[parentndx])
|
||||||
rel->attr_widths[parentndx] = childrel->attr_widths[childndx];
|
rel->attr_widths[parentndx] = childrel->attr_widths[childndx];
|
||||||
childvars = lnext(childvars);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@
|
|||||||
* Portions Copyright (c) 1994, Regents of the University of California
|
* Portions Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/backend/optimizer/path/costsize.c,v 1.128 2004/05/30 23:40:28 neilc Exp $
|
* $PostgreSQL: pgsql/src/backend/optimizer/path/costsize.c,v 1.129 2004/06/01 03:02:52 tgl Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -1701,7 +1701,7 @@ set_rel_width(Query *root, RelOptInfo *rel)
|
|||||||
int32 tuple_width = 0;
|
int32 tuple_width = 0;
|
||||||
ListCell *tllist;
|
ListCell *tllist;
|
||||||
|
|
||||||
foreach(tllist, FastListValue(&rel->reltargetlist))
|
foreach(tllist, rel->reltargetlist)
|
||||||
{
|
{
|
||||||
Var *var = (Var *) lfirst(tllist);
|
Var *var = (Var *) lfirst(tllist);
|
||||||
int ndx = var->varattno - rel->min_attr;
|
int ndx = var->varattno - rel->min_attr;
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
* Portions Copyright (c) 1994, Regents of the University of California
|
* Portions Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/backend/optimizer/path/pathkeys.c,v 1.58 2004/05/30 23:40:28 neilc Exp $
|
* $PostgreSQL: pgsql/src/backend/optimizer/path/pathkeys.c,v 1.59 2004/06/01 03:02:52 tgl Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -721,12 +721,11 @@ find_indexkey_var(Query *root, RelOptInfo *rel, AttrNumber varattno)
|
|||||||
vartypeid;
|
vartypeid;
|
||||||
int32 type_mod;
|
int32 type_mod;
|
||||||
|
|
||||||
foreach(temp, FastListValue(&rel->reltargetlist))
|
foreach(temp, rel->reltargetlist)
|
||||||
{
|
{
|
||||||
Var *var = (Var *) lfirst(temp);
|
Var *var = (Var *) lfirst(temp);
|
||||||
|
|
||||||
if (IsA(var, Var) &&
|
if (var->varattno == varattno)
|
||||||
var->varattno == varattno)
|
|
||||||
return var;
|
return var;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/backend/optimizer/plan/createplan.c,v 1.171 2004/05/30 23:40:28 neilc Exp $
|
* $PostgreSQL: pgsql/src/backend/optimizer/plan/createplan.c,v 1.172 2004/06/01 03:02:57 tgl Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -261,20 +261,19 @@ create_scan_plan(Query *root, Path *best_path)
|
|||||||
static List *
|
static List *
|
||||||
build_relation_tlist(RelOptInfo *rel)
|
build_relation_tlist(RelOptInfo *rel)
|
||||||
{
|
{
|
||||||
FastList tlist;
|
List *tlist = NIL;
|
||||||
int resdomno = 1;
|
int resdomno = 1;
|
||||||
ListCell *v;
|
ListCell *v;
|
||||||
|
|
||||||
FastListInit(&tlist);
|
foreach(v, rel->reltargetlist)
|
||||||
foreach(v, FastListValue(&rel->reltargetlist))
|
|
||||||
{
|
{
|
||||||
/* Do we really need to copy here? Not sure */
|
/* Do we really need to copy here? Not sure */
|
||||||
Var *var = (Var *) copyObject(lfirst(v));
|
Var *var = (Var *) copyObject(lfirst(v));
|
||||||
|
|
||||||
FastAppend(&tlist, create_tl_element(var, resdomno));
|
tlist = lappend(tlist, create_tl_element(var, resdomno));
|
||||||
resdomno++;
|
resdomno++;
|
||||||
}
|
}
|
||||||
return FastListValue(&tlist);
|
return tlist;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -701,7 +700,7 @@ create_indexscan_plan(Query *root,
|
|||||||
List *indxstrategy;
|
List *indxstrategy;
|
||||||
List *indxsubtype;
|
List *indxsubtype;
|
||||||
List *indxlossy;
|
List *indxlossy;
|
||||||
FastList indexids;
|
List *indexids;
|
||||||
ListCell *l;
|
ListCell *l;
|
||||||
IndexScan *scan_plan;
|
IndexScan *scan_plan;
|
||||||
|
|
||||||
@ -737,12 +736,12 @@ create_indexscan_plan(Query *root,
|
|||||||
scan_clauses = order_qual_clauses(root, scan_clauses);
|
scan_clauses = order_qual_clauses(root, scan_clauses);
|
||||||
|
|
||||||
/* Build list of index OIDs */
|
/* Build list of index OIDs */
|
||||||
FastListInit(&indexids);
|
indexids = NIL;
|
||||||
foreach(l, best_path->indexinfo)
|
foreach(l, best_path->indexinfo)
|
||||||
{
|
{
|
||||||
IndexOptInfo *index = (IndexOptInfo *) lfirst(l);
|
IndexOptInfo *index = (IndexOptInfo *) lfirst(l);
|
||||||
|
|
||||||
FastAppendo(&indexids, index->indexoid);
|
indexids = lappend_oid(indexids, index->indexoid);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -801,7 +800,7 @@ create_indexscan_plan(Query *root,
|
|||||||
scan_plan = make_indexscan(tlist,
|
scan_plan = make_indexscan(tlist,
|
||||||
qpqual,
|
qpqual,
|
||||||
baserelid,
|
baserelid,
|
||||||
FastListValue(&indexids),
|
indexids,
|
||||||
fixed_indxquals,
|
fixed_indxquals,
|
||||||
stripped_indxquals,
|
stripped_indxquals,
|
||||||
indxstrategy,
|
indxstrategy,
|
||||||
@ -1427,28 +1426,27 @@ get_switched_clauses(List *clauses, Relids outerrelids)
|
|||||||
static List *
|
static List *
|
||||||
order_qual_clauses(Query *root, List *clauses)
|
order_qual_clauses(Query *root, List *clauses)
|
||||||
{
|
{
|
||||||
FastList nosubplans;
|
List *nosubplans;
|
||||||
FastList withsubplans;
|
List *withsubplans;
|
||||||
ListCell *l;
|
ListCell *l;
|
||||||
|
|
||||||
/* No need to work hard if the query is subselect-free */
|
/* No need to work hard if the query is subselect-free */
|
||||||
if (!root->hasSubLinks)
|
if (!root->hasSubLinks)
|
||||||
return clauses;
|
return clauses;
|
||||||
|
|
||||||
FastListInit(&nosubplans);
|
nosubplans = NIL;
|
||||||
FastListInit(&withsubplans);
|
withsubplans = NIL;
|
||||||
foreach(l, clauses)
|
foreach(l, clauses)
|
||||||
{
|
{
|
||||||
Node *clause = (Node *) lfirst(l);
|
Node *clause = (Node *) lfirst(l);
|
||||||
|
|
||||||
if (contain_subplans(clause))
|
if (contain_subplans(clause))
|
||||||
FastAppend(&withsubplans, clause);
|
withsubplans = lappend(withsubplans, clause);
|
||||||
else
|
else
|
||||||
FastAppend(&nosubplans, clause);
|
nosubplans = lappend(nosubplans, clause);
|
||||||
}
|
}
|
||||||
|
|
||||||
FastConcFast(&nosubplans, &withsubplans);
|
return list_concat(nosubplans, withsubplans);
|
||||||
return FastListValue(&nosubplans);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/backend/optimizer/plan/initsplan.c,v 1.100 2004/05/30 23:40:29 neilc Exp $
|
* $PostgreSQL: pgsql/src/backend/optimizer/plan/initsplan.c,v 1.101 2004/06/01 03:02:58 tgl Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -151,7 +151,7 @@ add_vars_to_targetlist(Query *root, List *vars, Relids where_needed)
|
|||||||
{
|
{
|
||||||
/* Variable not yet requested, so add to reltargetlist */
|
/* Variable not yet requested, so add to reltargetlist */
|
||||||
/* XXX is copyObject necessary here? */
|
/* XXX is copyObject necessary here? */
|
||||||
FastAppend(&rel->reltargetlist, copyObject(var));
|
rel->reltargetlist = lappend(rel->reltargetlist, copyObject(var));
|
||||||
}
|
}
|
||||||
rel->attr_needed[attrno] = bms_add_members(rel->attr_needed[attrno],
|
rel->attr_needed[attrno] = bms_add_members(rel->attr_needed[attrno],
|
||||||
where_needed);
|
where_needed);
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/backend/optimizer/util/pathnode.c,v 1.106 2004/05/30 23:40:31 neilc Exp $
|
* $PostgreSQL: pgsql/src/backend/optimizer/util/pathnode.c,v 1.107 2004/06/01 03:03:02 tgl Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -691,7 +691,7 @@ create_unique_path(Query *root, RelOptInfo *rel, Path *subpath)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
pathnode->rows = rel->rows;
|
pathnode->rows = rel->rows;
|
||||||
numCols = list_length(FastListValue(&rel->reltargetlist));
|
numCols = list_length(rel->reltargetlist);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/backend/optimizer/util/relnode.c,v 1.58 2004/05/30 23:40:31 neilc Exp $
|
* $PostgreSQL: pgsql/src/backend/optimizer/util/relnode.c,v 1.59 2004/06/01 03:03:02 tgl Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -130,7 +130,7 @@ make_base_rel(Query *root, int relid)
|
|||||||
rel->relids = bms_make_singleton(relid);
|
rel->relids = bms_make_singleton(relid);
|
||||||
rel->rows = 0;
|
rel->rows = 0;
|
||||||
rel->width = 0;
|
rel->width = 0;
|
||||||
FastListInit(&rel->reltargetlist);
|
rel->reltargetlist = NIL;
|
||||||
rel->pathlist = NIL;
|
rel->pathlist = NIL;
|
||||||
rel->cheapest_startup_path = NULL;
|
rel->cheapest_startup_path = NULL;
|
||||||
rel->cheapest_total_path = NULL;
|
rel->cheapest_total_path = NULL;
|
||||||
@ -285,7 +285,7 @@ build_join_rel(Query *root,
|
|||||||
joinrel->relids = bms_copy(joinrelids);
|
joinrel->relids = bms_copy(joinrelids);
|
||||||
joinrel->rows = 0;
|
joinrel->rows = 0;
|
||||||
joinrel->width = 0;
|
joinrel->width = 0;
|
||||||
FastListInit(&joinrel->reltargetlist);
|
joinrel->reltargetlist = NIL;
|
||||||
joinrel->pathlist = NIL;
|
joinrel->pathlist = NIL;
|
||||||
joinrel->cheapest_startup_path = NULL;
|
joinrel->cheapest_startup_path = NULL;
|
||||||
joinrel->cheapest_total_path = NULL;
|
joinrel->cheapest_total_path = NULL;
|
||||||
@ -365,7 +365,7 @@ build_joinrel_tlist(Query *root, RelOptInfo *joinrel)
|
|||||||
Relids relids = joinrel->relids;
|
Relids relids = joinrel->relids;
|
||||||
ListCell *rels;
|
ListCell *rels;
|
||||||
|
|
||||||
FastListInit(&joinrel->reltargetlist);
|
joinrel->reltargetlist = NIL;
|
||||||
joinrel->width = 0;
|
joinrel->width = 0;
|
||||||
|
|
||||||
foreach(rels, root->base_rel_list)
|
foreach(rels, root->base_rel_list)
|
||||||
@ -376,14 +376,14 @@ build_joinrel_tlist(Query *root, RelOptInfo *joinrel)
|
|||||||
if (!bms_is_member(baserel->relid, relids))
|
if (!bms_is_member(baserel->relid, relids))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
foreach(vars, FastListValue(&baserel->reltargetlist))
|
foreach(vars, baserel->reltargetlist)
|
||||||
{
|
{
|
||||||
Var *var = (Var *) lfirst(vars);
|
Var *var = (Var *) lfirst(vars);
|
||||||
int ndx = var->varattno - baserel->min_attr;
|
int ndx = var->varattno - baserel->min_attr;
|
||||||
|
|
||||||
if (bms_nonempty_difference(baserel->attr_needed[ndx], relids))
|
if (bms_nonempty_difference(baserel->attr_needed[ndx], relids))
|
||||||
{
|
{
|
||||||
FastAppend(&joinrel->reltargetlist, var);
|
joinrel->reltargetlist = lappend(joinrel->reltargetlist, var);
|
||||||
Assert(baserel->attr_widths[ndx] > 0);
|
Assert(baserel->attr_widths[ndx] > 0);
|
||||||
joinrel->width += baserel->attr_widths[ndx];
|
joinrel->width += baserel->attr_widths[ndx];
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
|
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
|
||||||
* Portions Copyright (c) 1994, Regents of the University of California
|
* Portions Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* $PostgreSQL: pgsql/src/include/nodes/relation.h,v 1.94 2004/04/25 18:23:57 neilc Exp $
|
* $PostgreSQL: pgsql/src/include/nodes/relation.h,v 1.95 2004/06/01 03:03:05 tgl Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -186,7 +186,7 @@ typedef struct RelOptInfo
|
|||||||
int width; /* estimated avg width of result tuples */
|
int width; /* estimated avg width of result tuples */
|
||||||
|
|
||||||
/* materialization information */
|
/* materialization information */
|
||||||
FastList reltargetlist;
|
List *reltargetlist; /* needed Vars */
|
||||||
List *pathlist; /* Path structures */
|
List *pathlist; /* Path structures */
|
||||||
struct Path *cheapest_startup_path;
|
struct Path *cheapest_startup_path;
|
||||||
struct Path *cheapest_total_path;
|
struct Path *cheapest_total_path;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user