Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9188aab

Browse files
committed
add pathkeys description.
1 parent67fd67f commit9188aab

File tree

2 files changed

+29
-6
lines changed

2 files changed

+29
-6
lines changed

‎src/backend/optimizer/path/pathkeys.c

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/pathkeys.c,v 1.1 1999/02/2015:27:42 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/pathkeys.c,v 1.2 1999/02/2016:28:20 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -25,7 +25,6 @@
2525
#include"optimizer/joininfo.h"
2626
#include"optimizer/ordering.h"
2727

28-
2928
staticintmatch_pathkey_joinkeys(List*pathkey,List*joinkeys,
3029
intouter_or_inner);
3130
staticbooljoinkeys_pathkeys_match(List*joinkeys,List*pathkey,
@@ -35,6 +34,29 @@ static List *new_join_pathkey(List *subkeys, List *considered_subkeys,
3534
staticList*new_matching_subkeys(Var*subkey,List*considered_subkeys,
3635
List*join_rel_tlist,List*joinclauses);
3736

37+
38+
/*
39+
*Explanation of Path.pathkeys
40+
*
41+
*This structure is a List of List of Var nodes that represent the sort
42+
*order of the result generated by the Path.
43+
*
44+
*In single/base relation RelOptInfo's, the Path's represent various ways
45+
*of generate the relation. Sequential scan Paths have a NIL pathkeys.
46+
*Index scans have Path.pathkeys that represent the chosen index. A
47+
*single-key index pathkeys would be { {tab1_indexkey1} }. The pathkeys
48+
*entry for a multi-key index would be { {tab1_indexkey1}, {tab1_indexkey2} }.
49+
*
50+
*Multi-relation RelOptInfo Path's are more complicated. Mergejoins are
51+
*only performed with equajoins("="). Because of this, the multi-relation
52+
*path actually has more than one ordering. For example, a mergejoin Path
53+
*of "tab1.col1 = tab2.col1" would generate a pathkeys of
54+
*{ {tab1.col1, tab2.col1} }. This allows future joins to use either Var
55+
*as a pre-sorted key to prevent Mergejoins from having to re-sort the Path.
56+
*They are equal, so they are both primary sort keys. This is why pathkeys
57+
*is a List of Lists.
58+
*/
59+
3860
/****************************************************************************
3961
*KEY COMPARISONS
4062
****************************************************************************/

‎src/include/nodes/relation.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*
77
* Copyright (c) 1994, Regents of the University of California
88
*
9-
* $Id: relation.h,v 1.26 1999/02/18 00:49:38 momjian Exp $
9+
* $Id: relation.h,v 1.27 1999/02/20 16:28:20 momjian Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -142,9 +142,10 @@ typedef struct Path
142142

143143
PathOrder*pathorder;
144144

145-
List*pathkeys;/* This is a List of List of Var nodes.
146-
* It is a List of Lists because of multi-key
147-
* indexes.
145+
List*pathkeys;/*
146+
* This is a List of List of Var nodes.
147+
* See the top of optimizer/path/pathkeys.c
148+
* for more information.
148149
*/
149150
Costouterjoincost;
150151
Relidsjoinid;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp