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
f7430af9
Commit
f7430af9
authored
Mar 08, 1999
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix OR index selectivity problem.
parent
c831d08f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
27 deletions
+19
-27
src/backend/optimizer/path/orindxpath.c
src/backend/optimizer/path/orindxpath.c
+18
-25
src/backend/optimizer/util/plancat.c
src/backend/optimizer/util/plancat.c
+1
-2
No files found.
src/backend/optimizer/path/orindxpath.c
View file @
f7430af9
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/orindxpath.c,v 1.2
2 1999/03/08 13:35:50
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/orindxpath.c,v 1.2
3 1999/03/08 14:01:55
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -33,8 +33,7 @@
static
void
best_or_subclause_indices
(
Query
*
root
,
RelOptInfo
*
rel
,
List
*
subclauses
,
List
*
indices
,
List
*
examined_indexids
,
Cost
subcost
,
List
*
selectivities
,
List
**
indexids
,
Cost
*
cost
,
List
**
selecs
);
List
*
indices
,
List
**
indexids
,
Cost
*
cost
,
Cost
*
selec
);
static
void
best_or_subclause_index
(
Query
*
root
,
RelOptInfo
*
rel
,
Expr
*
subclause
,
List
*
indices
,
int
*
indexid
,
Cost
*
cost
,
Cost
*
selec
);
...
...
@@ -87,20 +86,17 @@ create_or_index_paths(Query *root,
if
(
index_flag
)
{
/* used to be a lisp every function */
IndexPath
*
pathnode
=
makeNode
(
IndexPath
);
List
*
indexids
;
List
*
indexids
=
NIL
;
Cost
cost
;
List
*
selecs
;
Cost
selec
;
best_or_subclause_indices
(
root
,
rel
,
clausenode
->
clause
->
args
,
clausenode
->
indexids
,
NIL
,
(
Cost
)
0
,
NIL
,
&
indexids
,
&
cost
,
&
selec
s
);
&
selec
);
pathnode
->
path
.
pathtype
=
T_IndexScan
;
pathnode
->
path
.
parent
=
rel
;
...
...
@@ -132,7 +128,7 @@ create_or_index_paths(Query *root,
((
Path
*
)
pathnode
)
->
path_cost
+=
xfunc_get_path_cost
((
Path
)
pathnode
);
}
#endif
clausenode
->
selectivity
=
(
Cost
)
floatVal
(
lfirst
(
selecs
))
;
clausenode
->
selectivity
=
(
Cost
)
selec
;
t_list
=
lappend
(
t_list
,
pathnode
);
}
}
...
...
@@ -154,8 +150,7 @@ create_or_index_paths(Query *root,
* 'examined_indexids' is a list of those index ids to be used with
* subclauses that have already been examined
* 'subcost' is the cost of using the indices in 'examined_indexids'
* 'selectivities' is a list of the selectivities of subclauses that
* have already been examined
* 'selec' is a list of all subclauses that have already been examined
*
* Returns a list of the indexids, cost, and selectivities of each
* subclause, e.g., ((i1 i2 i3) cost (s1 s2 s3)), where 'i' is an OID,
...
...
@@ -166,15 +161,15 @@ best_or_subclause_indices(Query *root,
RelOptInfo
*
rel
,
List
*
subclauses
,
List
*
indices
,
List
*
examined_indexids
,
Cost
subcost
,
List
*
selectivities
,
List
**
indexids
,
/* return value */
Cost
*
cost
,
/* return value */
List
**
selecs
)
/* return value */
Cost
*
cost
,
/* return value */
Cost
*
selec
)
/* return value */
{
List
*
slist
;
List
*
slist
;
*
selec
=
(
Cost
)
0
.
0
;
*
cost
=
(
Cost
)
0
.
0
;
foreach
(
slist
,
subclauses
)
{
int
best_indexid
;
...
...
@@ -184,17 +179,15 @@ best_or_subclause_indices(Query *root,
best_or_subclause_index
(
root
,
rel
,
lfirst
(
slist
),
lfirst
(
indices
),
&
best_indexid
,
&
best_cost
,
&
best_selec
);
examined_indexids
=
lappendi
(
examined_indexids
,
best_indexid
);
subcost
+=
best_cost
;
selectivities
=
lappend
(
selectivities
,
makeFloat
(
best_selec
));
*
indexids
=
lappendi
(
*
indexids
,
best_indexid
);
*
cost
+=
best_cost
;
*
selec
+=
best_selec
;
if
(
*
selec
>
(
Cost
)
1
.
0
)
*
selec
=
(
Cost
)
1
.
0
;
indices
=
lnext
(
indices
);
}
*
indexids
=
examined_indexids
;
*
cost
=
subcost
;
*
selecs
=
selectivities
;
return
;
}
...
...
src/backend/optimizer/util/plancat.c
View file @
f7430af9
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/plancat.c,v 1.2
6 1999/02/21 03:48:54 scrappy
Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/plancat.c,v 1.2
7 1999/03/08 14:01:57 momjian
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -545,7 +545,6 @@ IndexSelectivity(Oid indexrelid,
select
=
1
.
0
;
for
(
n
=
0
;
n
<
nIndexKeys
;
++
n
)
{
/*
* Find the AM class for this key.
*
...
...
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