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
ce3afccf
Commit
ce3afccf
authored
Feb 04, 1999
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More optimizer cleanups.
parent
18fbe414
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
49 additions
and
39 deletions
+49
-39
src/backend/nodes/copyfuncs.c
src/backend/nodes/copyfuncs.c
+7
-7
src/backend/nodes/readfuncs.c
src/backend/nodes/readfuncs.c
+2
-2
src/backend/optimizer/README
src/backend/optimizer/README
+17
-5
src/backend/optimizer/path/hashutils.c
src/backend/optimizer/path/hashutils.c
+2
-2
src/backend/optimizer/path/joinpath.c
src/backend/optimizer/path/joinpath.c
+6
-7
src/backend/optimizer/path/mergeutils.c
src/backend/optimizer/path/mergeutils.c
+6
-6
src/include/nodes/nodes.h
src/include/nodes/nodes.h
+2
-2
src/include/nodes/relation.h
src/include/nodes/relation.h
+5
-6
src/include/optimizer/paths.h
src/include/optimizer/paths.h
+2
-2
No files found.
src/backend/nodes/copyfuncs.c
View file @
ce3afccf
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.6
0 1999/02/04 01:46:53
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.6
1 1999/02/04 03:19:06
momjian Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -1397,13 +1397,13 @@ _copyHashInfo(HashInfo *from)
...
@@ -1397,13 +1397,13 @@ _copyHashInfo(HashInfo *from)
}
}
/* ----------------
/* ----------------
* _copyMInfo
* _copyM
erge
Info
* ----------------
* ----------------
*/
*/
static
MInfo
*
static
M
erge
Info
*
_copyM
Info
(
M
Info
*
from
)
_copyM
ergeInfo
(
Merge
Info
*
from
)
{
{
M
Info
*
newnode
=
makeNode
(
M
Info
);
M
ergeInfo
*
newnode
=
makeNode
(
Merge
Info
);
/* ----------------
/* ----------------
* copy remainder of node
* copy remainder of node
...
@@ -1800,8 +1800,8 @@ copyObject(void *from)
...
@@ -1800,8 +1800,8 @@ copyObject(void *from)
case
T_HashInfo
:
case
T_HashInfo
:
retval
=
_copyHashInfo
(
from
);
retval
=
_copyHashInfo
(
from
);
break
;
break
;
case
T_MInfo
:
case
T_M
erge
Info
:
retval
=
_copyMInfo
(
from
);
retval
=
_copyM
erge
Info
(
from
);
break
;
break
;
case
T_JoinInfo
:
case
T_JoinInfo
:
retval
=
_copyJoinInfo
(
from
);
retval
=
_copyJoinInfo
(
from
);
...
...
src/backend/nodes/readfuncs.c
View file @
ce3afccf
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.4
7 1999/02/04 01:46:54
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.4
8 1999/02/04 03:19:06
momjian Exp $
*
*
* NOTES
* NOTES
* Most of the read functions for plan nodes are tested. (In fact, they
* Most of the read functions for plan nodes are tested. (In fact, they
...
@@ -1914,7 +1914,7 @@ _readJoinMethod()
...
@@ -1914,7 +1914,7 @@ _readJoinMethod()
static
HashInfo
*
static
HashInfo
*
_readHashInfo
()
_readHashInfo
()
{
{
HashInfo
*
local_node
;
HashInfo
*
local_node
;
char
*
token
;
char
*
token
;
int
length
;
int
length
;
...
...
src/backend/optimizer/README
View file @
ce3afccf
Optimizer Functions
-------------------
These directories take the Query structure returned by the parser, and
These directories take the Query structure returned by the parser, and
generate a plan used by the executor. The /plan directory generates the
generate a plan used by the executor. The /plan directory generates the
plan, the /path generates all possible ways to join the tables, and
plan, the /path generates all possible ways to join the tables, and
...
@@ -93,9 +96,18 @@ planner()
...
@@ -93,9 +96,18 @@ planner()
Optimizer Structures
Optimizer Structures
--------------------
--------------------
RelOptInfo - info about every relation
RestrictInfo - info about restrictions
RelOptInfo - Every relation
JoinInfo - info about join combinations
Path - info about every way to access a relation(sequential, index)
RestrictInfo - restriction clauses
PathOrder - info about every ordering (sort, merge of relations)
JoinInfo - join combinations
Path - every way to access a relation(sequential, index)
IndexPath - index scans
JoinPath - joins
MergePath - merge joins
HashPath - hash joins
PathOrder - every ordering type (sort, merge of relations)
src/backend/optimizer/path/hashutils.c
View file @
ce3afccf
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/hashutils.c,v 1.1
0 1999/02/04 01:46:57
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/hashutils.c,v 1.1
1 1999/02/04 03:19:08
momjian Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -54,7 +54,7 @@ group_clauses_by_hashop(List *restrictinfo_list,
...
@@ -54,7 +54,7 @@ group_clauses_by_hashop(List *restrictinfo_list,
*/
*/
if
(
hashjoinop
)
if
(
hashjoinop
)
{
{
HashInfo
*
xhashinfo
=
(
HashInfo
*
)
NULL
;
HashInfo
*
xhashinfo
=
(
HashInfo
*
)
NULL
;
Expr
*
clause
=
restrictinfo
->
clause
;
Expr
*
clause
=
restrictinfo
->
clause
;
Var
*
leftop
=
get_leftop
(
clause
);
Var
*
leftop
=
get_leftop
(
clause
);
Var
*
rightop
=
get_rightop
(
clause
);
Var
*
rightop
=
get_rightop
(
clause
);
...
...
src/backend/optimizer/path/joinpath.c
View file @
ce3afccf
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinpath.c,v 1.1
3 1999/02/04 01:46:57
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinpath.c,v 1.1
4 1999/02/04 03:19:08
momjian Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -162,7 +162,6 @@ find_all_join_paths(Query *root, List *joinrels)
...
@@ -162,7 +162,6 @@ find_all_join_paths(Query *root, List *joinrels)
temp_list
=
innerrel
->
pathlist
;
temp_list
=
innerrel
->
pathlist
;
foreach
(
path
,
temp_list
)
foreach
(
path
,
temp_list
)
{
{
/*
/*
* XXX
* XXX
*
*
...
@@ -235,7 +234,7 @@ sort_inner_and_outer(RelOptInfo * joinrel,
...
@@ -235,7 +234,7 @@ sort_inner_and_outer(RelOptInfo * joinrel,
List
*
mergeinfo_list
)
List
*
mergeinfo_list
)
{
{
List
*
ms_list
=
NIL
;
List
*
ms_list
=
NIL
;
M
Info
*
xmergeinfo
=
(
M
Info
*
)
NULL
;
M
ergeInfo
*
xmergeinfo
=
(
Merge
Info
*
)
NULL
;
MergePath
*
temp_node
=
(
MergePath
*
)
NULL
;
MergePath
*
temp_node
=
(
MergePath
*
)
NULL
;
List
*
i
;
List
*
i
;
List
*
outerkeys
=
NIL
;
List
*
outerkeys
=
NIL
;
...
@@ -244,7 +243,7 @@ sort_inner_and_outer(RelOptInfo * joinrel,
...
@@ -244,7 +243,7 @@ sort_inner_and_outer(RelOptInfo * joinrel,
foreach
(
i
,
mergeinfo_list
)
foreach
(
i
,
mergeinfo_list
)
{
{
xmergeinfo
=
(
MInfo
*
)
lfirst
(
i
);
xmergeinfo
=
(
M
erge
Info
*
)
lfirst
(
i
);
outerkeys
=
extract_path_keys
(
xmergeinfo
->
jmethod
.
jmkeys
,
outerkeys
=
extract_path_keys
(
xmergeinfo
->
jmethod
.
jmkeys
,
outerrel
->
targetlist
,
outerrel
->
targetlist
,
...
@@ -325,7 +324,7 @@ match_unsorted_outer(RelOptInfo * joinrel,
...
@@ -325,7 +324,7 @@ match_unsorted_outer(RelOptInfo * joinrel,
List
*
clauses
=
NIL
;
List
*
clauses
=
NIL
;
List
*
matchedJoinKeys
=
NIL
;
List
*
matchedJoinKeys
=
NIL
;
List
*
matchedJoinClauses
=
NIL
;
List
*
matchedJoinClauses
=
NIL
;
M
Info
*
xmergeinfo
=
(
M
Info
*
)
NULL
;
M
ergeInfo
*
xmergeinfo
=
(
Merge
Info
*
)
NULL
;
outerpath
=
(
Path
*
)
lfirst
(
i
);
outerpath
=
(
Path
*
)
lfirst
(
i
);
...
@@ -465,7 +464,7 @@ match_unsorted_inner(RelOptInfo * joinrel,
...
@@ -465,7 +464,7 @@ match_unsorted_inner(RelOptInfo * joinrel,
foreach
(
i
,
innerpath_list
)
foreach
(
i
,
innerpath_list
)
{
{
M
Info
*
xmergeinfo
=
(
M
Info
*
)
NULL
;
M
ergeInfo
*
xmergeinfo
=
(
Merge
Info
*
)
NULL
;
List
*
clauses
=
NIL
;
List
*
clauses
=
NIL
;
List
*
matchedJoinKeys
=
NIL
;
List
*
matchedJoinKeys
=
NIL
;
List
*
matchedJoinClauses
=
NIL
;
List
*
matchedJoinClauses
=
NIL
;
...
@@ -579,7 +578,7 @@ hash_inner_and_outer(RelOptInfo * joinrel,
...
@@ -579,7 +578,7 @@ hash_inner_and_outer(RelOptInfo * joinrel,
RelOptInfo
*
innerrel
,
RelOptInfo
*
innerrel
,
List
*
hashinfo_list
)
List
*
hashinfo_list
)
{
{
HashInfo
*
xhashinfo
=
(
HashInfo
*
)
NULL
;
HashInfo
*
xhashinfo
=
(
HashInfo
*
)
NULL
;
List
*
hjoin_list
=
NIL
;
List
*
hjoin_list
=
NIL
;
HashPath
*
temp_node
=
(
HashPath
*
)
NULL
;
HashPath
*
temp_node
=
(
HashPath
*
)
NULL
;
List
*
i
=
NIL
;
List
*
i
=
NIL
;
...
...
src/backend/optimizer/path/mergeutils.c
View file @
ce3afccf
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/mergeutils.c,v 1.1
1 1999/02/03 21:16:27
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/mergeutils.c,v 1.1
2 1999/02/04 03:19:09
momjian Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -53,7 +53,7 @@ group_clauses_by_order(List *restrictinfo_list,
...
@@ -53,7 +53,7 @@ group_clauses_by_order(List *restrictinfo_list,
* if one does not yet exist for this merge ordering.
* if one does not yet exist for this merge ordering.
*/
*/
PathOrder
p_ordering
;
PathOrder
p_ordering
;
MInfo
*
xmergeinfo
;
M
erge
Info
*
xmergeinfo
;
Expr
*
clause
=
restrictinfo
->
clause
;
Expr
*
clause
=
restrictinfo
->
clause
;
Var
*
leftop
=
get_leftop
(
clause
);
Var
*
leftop
=
get_leftop
(
clause
);
Var
*
rightop
=
get_rightop
(
clause
);
Var
*
rightop
=
get_rightop
(
clause
);
...
@@ -77,7 +77,7 @@ group_clauses_by_order(List *restrictinfo_list,
...
@@ -77,7 +77,7 @@ group_clauses_by_order(List *restrictinfo_list,
if
(
xmergeinfo
==
NULL
)
if
(
xmergeinfo
==
NULL
)
{
{
xmergeinfo
=
makeNode
(
MInfo
);
xmergeinfo
=
makeNode
(
M
erge
Info
);
xmergeinfo
->
m_ordering
=
merge_ordering
;
xmergeinfo
->
m_ordering
=
merge_ordering
;
mergeinfo_list
=
lcons
(
xmergeinfo
,
mergeinfo_list
=
lcons
(
xmergeinfo
,
...
@@ -102,7 +102,7 @@ group_clauses_by_order(List *restrictinfo_list,
...
@@ -102,7 +102,7 @@ group_clauses_by_order(List *restrictinfo_list,
* Returns the node if it exists.
* Returns the node if it exists.
*
*
*/
*/
MInfo
*
M
erge
Info
*
match_order_mergeinfo
(
PathOrder
*
ordering
,
List
*
mergeinfo_list
)
match_order_mergeinfo
(
PathOrder
*
ordering
,
List
*
mergeinfo_list
)
{
{
MergeOrder
*
xmergeorder
;
MergeOrder
*
xmergeorder
;
...
@@ -110,7 +110,7 @@ match_order_mergeinfo(PathOrder *ordering, List *mergeinfo_list)
...
@@ -110,7 +110,7 @@ match_order_mergeinfo(PathOrder *ordering, List *mergeinfo_list)
foreach
(
xmergeinfo
,
mergeinfo_list
)
foreach
(
xmergeinfo
,
mergeinfo_list
)
{
{
M
Info
*
mergeinfo
=
(
M
Info
*
)
lfirst
(
xmergeinfo
);
M
ergeInfo
*
mergeinfo
=
(
Merge
Info
*
)
lfirst
(
xmergeinfo
);
xmergeorder
=
mergeinfo
->
m_ordering
;
xmergeorder
=
mergeinfo
->
m_ordering
;
...
@@ -123,5 +123,5 @@ match_order_mergeinfo(PathOrder *ordering, List *mergeinfo_list)
...
@@ -123,5 +123,5 @@ match_order_mergeinfo(PathOrder *ordering, List *mergeinfo_list)
return
mergeinfo
;
return
mergeinfo
;
}
}
}
}
return
(
MInfo
*
)
NIL
;
return
(
M
erge
Info
*
)
NIL
;
}
}
src/include/nodes/nodes.h
View file @
ce3afccf
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
*
*
* Copyright (c) 1994, Regents of the University of California
* Copyright (c) 1994, Regents of the University of California
*
*
* $Id: nodes.h,v 1.3
7 1999/02/04 01:47:0
0 momjian Exp $
* $Id: nodes.h,v 1.3
8 1999/02/04 03:19:1
0 momjian Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -82,7 +82,7 @@ typedef enum NodeTag
...
@@ -82,7 +82,7 @@ typedef enum NodeTag
T_RestrictInfo
,
T_RestrictInfo
,
T_JoinMethod
,
T_JoinMethod
,
T_HashInfo
,
T_HashInfo
,
T_MInfo
,
T_M
erge
Info
,
T_JoinInfo
,
T_JoinInfo
,
T_Iter
,
T_Iter
,
T_Stream
,
T_Stream
,
...
...
src/include/nodes/relation.h
View file @
ce3afccf
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
*
*
* Copyright (c) 1994, Regents of the University of California
* Copyright (c) 1994, Regents of the University of California
*
*
* $Id: relation.h,v 1.1
3 1999/02/04 01:47:02
momjian Exp $
* $Id: relation.h,v 1.1
4 1999/02/04 03:19:10
momjian Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -47,7 +47,7 @@ typedef List *Relid;
...
@@ -47,7 +47,7 @@ typedef List *Relid;
* leaves the tuples unordered)
* leaves the tuples unordered)
* cheapestpath - least expensive Path (regardless of final order)
* cheapestpath - least expensive Path (regardless of final order)
* pruneable - flag to let the planner know whether it can prune the plan
* pruneable - flag to let the planner know whether it can prune the plan
* space of this RelOptInfo or not.
-- JMH, 11/11/92
* space of this RelOptInfo or not.
*
*
* * If the relation is a (secondary) index it will have the following
* * If the relation is a (secondary) index it will have the following
* three fields:
* three fields:
...
@@ -157,8 +157,7 @@ typedef struct IndexPath
...
@@ -157,8 +157,7 @@ typedef struct IndexPath
Path
path
;
Path
path
;
List
*
indexid
;
List
*
indexid
;
List
*
indexqual
;
List
*
indexqual
;
int
*
indexkeys
;
/* to transform heap attnos into index
int
*
indexkeys
;
/* to transform heap attnos into index ones */
* ones */
}
IndexPath
;
}
IndexPath
;
typedef
struct
JoinPath
typedef
struct
JoinPath
...
@@ -236,11 +235,11 @@ typedef struct HashInfo
...
@@ -236,11 +235,11 @@ typedef struct HashInfo
Oid
hashop
;
Oid
hashop
;
}
HashInfo
;
}
HashInfo
;
typedef
struct
MInfo
typedef
struct
M
erge
Info
{
{
JoinMethod
jmethod
;
JoinMethod
jmethod
;
MergeOrder
*
m_ordering
;
MergeOrder
*
m_ordering
;
}
MInfo
;
}
M
erge
Info
;
typedef
struct
JoinInfo
typedef
struct
JoinInfo
{
{
...
...
src/include/optimizer/paths.h
View file @
ce3afccf
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
* Copyright (c) 1994, Regents of the University of California
* Copyright (c) 1994, Regents of the University of California
*
*
* $Id: paths.h,v 1.1
1 1999/02/03 20:15:53
momjian Exp $
* $Id: paths.h,v 1.1
2 1999/02/04 03:19:11
momjian Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -70,7 +70,7 @@ extern List *new_join_pathkeys(List *outer_pathkeys,
...
@@ -70,7 +70,7 @@ extern List *new_join_pathkeys(List *outer_pathkeys,
*/
*/
extern
List
*
group_clauses_by_order
(
List
*
restrictinfo_list
,
extern
List
*
group_clauses_by_order
(
List
*
restrictinfo_list
,
int
inner_relid
);
int
inner_relid
);
extern
MInfo
*
match_order_mergeinfo
(
PathOrder
*
ordering
,
extern
M
erge
Info
*
match_order_mergeinfo
(
PathOrder
*
ordering
,
List
*
mergeinfo_list
);
List
*
mergeinfo_list
);
/*
/*
...
...
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