Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
80c6847c
Commit
80c6847c
authored
Jun 01, 2004
by
Tom Lane
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Desultory de-FastList-ification. RelOptInfo.reltargetlist is back to
being a plain List.
parent
6c33054a
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
38 additions
and
45 deletions
+38
-45
src/backend/optimizer/path/allpaths.c
src/backend/optimizer/path/allpaths.c
+5
-9
src/backend/optimizer/path/costsize.c
src/backend/optimizer/path/costsize.c
+2
-2
src/backend/optimizer/path/pathkeys.c
src/backend/optimizer/path/pathkeys.c
+3
-4
src/backend/optimizer/plan/createplan.c
src/backend/optimizer/plan/createplan.c
+16
-18
src/backend/optimizer/plan/initsplan.c
src/backend/optimizer/plan/initsplan.c
+2
-2
src/backend/optimizer/util/pathnode.c
src/backend/optimizer/util/pathnode.c
+2
-2
src/backend/optimizer/util/relnode.c
src/backend/optimizer/util/relnode.c
+6
-6
src/include/nodes/relation.h
src/include/nodes/relation.h
+2
-2
No files found.
src/backend/optimizer/path/allpaths.c
View file @
80c6847c
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/optimizer/path/allpaths.c,v 1.11
6 2004/05/30 23:40:28 neilc
Exp $
* $PostgreSQL: pgsql/src/backend/optimizer/path/allpaths.c,v 1.11
7 2004/06/01 03:02:51 tgl
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -246,7 +246,6 @@ set_inherited_rel_pathlist(Query *root, RelOptInfo *rel,
...
@@ -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,
...
@@ -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,
...
@@ -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,
...
@@ -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
);
}
}
}
}
...
...
src/backend/optimizer/path/costsize.c
View file @
80c6847c
...
@@ -49,7 +49,7 @@
...
@@ -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.12
8 2004/05/30 23:40:28 neilc
Exp $
* $PostgreSQL: pgsql/src/backend/optimizer/path/costsize.c,v 1.12
9 2004/06/01 03:02:52 tgl
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -1701,7 +1701,7 @@ set_rel_width(Query *root, RelOptInfo *rel)
...
@@ -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
;
...
...
src/backend/optimizer/path/pathkeys.c
View file @
80c6847c
...
@@ -11,7 +11,7 @@
...
@@ -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.5
8 2004/05/30 23:40:28 neilc
Exp $
* $PostgreSQL: pgsql/src/backend/optimizer/path/pathkeys.c,v 1.5
9 2004/06/01 03:02:52 tgl
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -721,12 +721,11 @@ find_indexkey_var(Query *root, RelOptInfo *rel, AttrNumber varattno)
...
@@ -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
;
}
}
...
...
src/backend/optimizer/plan/createplan.c
View file @
80c6847c
...
@@ -10,7 +10,7 @@
...
@@ -10,7 +10,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/optimizer/plan/createplan.c,v 1.17
1 2004/05/30 23:40:28 neilc
Exp $
* $PostgreSQL: pgsql/src/backend/optimizer/plan/createplan.c,v 1.17
2 2004/06/01 03:02:57 tgl
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -261,20 +261,19 @@ create_scan_plan(Query *root, Path *best_path)
...
@@ -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,
...
@@ -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,
...
@@ -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,
...
@@ -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)
...
@@ -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
);
}
}
/*
/*
...
...
src/backend/optimizer/plan/initsplan.c
View file @
80c6847c
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/optimizer/plan/initsplan.c,v 1.10
0 2004/05/30 23:40:29 neilc
Exp $
* $PostgreSQL: pgsql/src/backend/optimizer/plan/initsplan.c,v 1.10
1 2004/06/01 03:02:58 tgl
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -151,7 +151,7 @@ add_vars_to_targetlist(Query *root, List *vars, Relids where_needed)
...
@@ -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
);
...
...
src/backend/optimizer/util/pathnode.c
View file @
80c6847c
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/optimizer/util/pathnode.c,v 1.10
6 2004/05/30 23:40:31 neilc
Exp $
* $PostgreSQL: pgsql/src/backend/optimizer/util/pathnode.c,v 1.10
7 2004/06/01 03:03:02 tgl
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -691,7 +691,7 @@ create_unique_path(Query *root, RelOptInfo *rel, Path *subpath)
...
@@ -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
);
}
}
/*
/*
...
...
src/backend/optimizer/util/relnode.c
View file @
80c6847c
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/optimizer/util/relnode.c,v 1.5
8 2004/05/30 23:40:31 neilc
Exp $
* $PostgreSQL: pgsql/src/backend/optimizer/util/relnode.c,v 1.5
9 2004/06/01 03:03:02 tgl
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -130,7 +130,7 @@ make_base_rel(Query *root, int relid)
...
@@ -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,
...
@@ -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)
...
@@ -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)
...
@@ -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
];
}
}
...
...
src/include/nodes/relation.h
View file @
80c6847c
...
@@ -7,7 +7,7 @@
...
@@ -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.9
4 2004/04/25 18:23:57 neilc
Exp $
* $PostgreSQL: pgsql/src/include/nodes/relation.h,v 1.9
5 2004/06/01 03:03:05 tgl
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -186,7 +186,7 @@ typedef struct RelOptInfo
...
@@ -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
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment