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
600d3206
Commit
600d3206
authored
Oct 11, 2011
by
Tom Lane
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Consider index-only scans even when there is no matching qual or ORDER BY.
By popular demand.
parent
a0185461
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
13 deletions
+12
-13
src/backend/optimizer/path/indxpath.c
src/backend/optimizer/path/indxpath.c
+12
-13
No files found.
src/backend/optimizer/path/indxpath.c
View file @
600d3206
...
...
@@ -317,8 +317,7 @@ find_usable_indexes(PlannerInfo *root, RelOptInfo *rel,
bool
useful_predicate
;
bool
found_clause
;
bool
index_is_ordered
;
bool
index_only_scan
=
false
;
bool
checked_index_only
=
false
;
bool
index_only_scan
;
/*
* Check that index supports the desired scan type(s)
...
...
@@ -436,17 +435,20 @@ find_usable_indexes(PlannerInfo *root, RelOptInfo *rel,
}
/*
* 3. Generate an indexscan path if there are relevant restriction
* 3. Check if an index-only scan is possible.
*/
index_only_scan
=
check_index_only
(
rel
,
index
);
/*
* 4. Generate an indexscan path if there are relevant restriction
* clauses in the current clauses, OR the index ordering is
* potentially useful for later merging or final output ordering, OR
* the index has a predicate that was proven by the current clauses.
* the index has a predicate that was proven by the current clauses,
* OR an index-only scan is possible.
*/
if
(
found_clause
||
useful_pathkeys
!=
NIL
||
useful_predicate
)
if
(
found_clause
||
useful_pathkeys
!=
NIL
||
useful_predicate
||
index_only_scan
)
{
/* First, detect whether index-only scan is possible */
index_only_scan
=
check_index_only
(
rel
,
index
);
checked_index_only
=
true
;
ipath
=
create_index_path
(
root
,
index
,
restrictclauses
,
orderbyclauses
,
...
...
@@ -460,7 +462,7 @@ find_usable_indexes(PlannerInfo *root, RelOptInfo *rel,
}
/*
*
4
. If the index is ordered, a backwards scan might be interesting.
*
5
. If the index is ordered, a backwards scan might be interesting.
* Again, this is only interesting at top level.
*/
if
(
index_is_ordered
&&
possibly_useful_pathkeys
&&
...
...
@@ -472,9 +474,6 @@ find_usable_indexes(PlannerInfo *root, RelOptInfo *rel,
index_pathkeys
);
if
(
useful_pathkeys
!=
NIL
)
{
if
(
!
checked_index_only
)
index_only_scan
=
check_index_only
(
rel
,
index
);
ipath
=
create_index_path
(
root
,
index
,
restrictclauses
,
NIL
,
...
...
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