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
9c38a8d2
Commit
9c38a8d2
authored
Apr 09, 2000
by
Tom Lane
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Further tweaking of indexscan cost estimates.
parent
5db0ef84
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
6 deletions
+18
-6
src/backend/optimizer/path/costsize.c
src/backend/optimizer/path/costsize.c
+6
-3
src/backend/utils/adt/selfuncs.c
src/backend/utils/adt/selfuncs.c
+12
-3
No files found.
src/backend/optimizer/path/costsize.c
View file @
9c38a8d2
...
@@ -42,7 +42,7 @@
...
@@ -42,7 +42,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
* Portions Copyright (c) 1994, Regents of the University of California
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/costsize.c,v 1.5
5 2000/03/30 00:53:29
tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/costsize.c,v 1.5
6 2000/04/09 04:31:36
tgl Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -262,9 +262,12 @@ cost_index(Path *path, Query *root,
...
@@ -262,9 +262,12 @@ cost_index(Path *path, Query *root,
* effect. Would be nice to do better someday.
* effect. Would be nice to do better someday.
*/
*/
tuples_fetched
=
ceil
(
indexSelectivity
*
baserel
->
tuples
);
tuples_fetched
=
indexSelectivity
*
baserel
->
tuples
;
/* Don't believe estimates less than 1... */
if
(
tuples_fetched
<
1
.
0
)
tuples_fetched
=
1
.
0
;
if
(
tuples_fetched
>
0
&&
baserel
->
pages
>
0
)
if
(
baserel
->
pages
>
0
)
pages_fetched
=
ceil
(
baserel
->
pages
*
pages_fetched
=
ceil
(
baserel
->
pages
*
log
(
tuples_fetched
/
baserel
->
pages
+
1
.
0
));
log
(
tuples_fetched
/
baserel
->
pages
+
1
.
0
));
else
else
...
...
src/backend/utils/adt/selfuncs.c
View file @
9c38a8d2
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/selfuncs.c,v 1.6
2 2000/03/30 00:53:30
tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/selfuncs.c,v 1.6
3 2000/04/09 04:31:37
tgl Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -902,10 +902,19 @@ genericcostestimate(Query *root, RelOptInfo *rel,
...
@@ -902,10 +902,19 @@ genericcostestimate(Query *root, RelOptInfo *rel,
lfirsti
(
rel
->
relids
));
lfirsti
(
rel
->
relids
));
/* Estimate the number of index tuples that will be visited */
/* Estimate the number of index tuples that will be visited */
numIndexTuples
=
ceil
(
*
indexSelectivity
*
index
->
tuples
)
;
numIndexTuples
=
*
indexSelectivity
*
index
->
tuples
;
/* Estimate the number of index pages that will be retrieved */
/* Estimate the number of index pages that will be retrieved */
numIndexPages
=
ceil
(
*
indexSelectivity
*
index
->
pages
);
numIndexPages
=
*
indexSelectivity
*
index
->
pages
;
/*
* Always estimate at least one tuple and page are touched,
* even when indexSelectivity estimate is tiny.
*/
if
(
numIndexTuples
<
1
.
0
)
numIndexTuples
=
1
.
0
;
if
(
numIndexPages
<
1
.
0
)
numIndexPages
=
1
.
0
;
/*
/*
* Compute the index access cost.
* Compute the index access cost.
...
...
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