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

Appearance settings

Commit fe1431e

Browse filesBrowse files
committed
BitmapHeapScan: postpone setting can_skip_fetch
Set BitmapHeapScanState->can_skip_fetch in BitmapHeapNext() instead of in ExecInitBitmapHeapScan(). This is a preliminary step to pushing the skip fetch optimization into heap AM code. Author: Melanie Plageman Reviewed-by: Tomas Vondra, Andres Freund, Heikki Linnakangas Discussion: https://postgr.es/m/CAAKRu_ZwCwWFeL_H3ia26bP2e7HiKLWt0ZmGXPVwPO6uXq0vaA%40mail.gmail.com
1 parent 74eaf66 commit fe1431e
Copy full SHA for fe1431e

File tree

1 file changed

+11
-10
lines changed
Filter options

1 file changed

+11
-10
lines changed

‎src/backend/executor/nodeBitmapHeapscan.c

Copy file name to clipboardExpand all lines: src/backend/executor/nodeBitmapHeapscan.c
+11-10Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,16 @@ BitmapHeapNext(BitmapHeapScanState *node)
105105
*/
106106
if (!node->initialized)
107107
{
108+
/*
109+
* We can potentially skip fetching heap pages if we do not need any
110+
* columns of the table, either for checking non-indexable quals or
111+
* for returning data. This test is a bit simplistic, as it checks
112+
* the stronger condition that there's no qual or return tlist at all.
113+
* But in most cases it's probably not worth working harder than that.
114+
*/
115+
node->can_skip_fetch = (node->ss.ps.plan->qual == NIL &&
116+
node->ss.ps.plan->targetlist == NIL);
117+
108118
if (!pstate)
109119
{
110120
tbm = (TIDBitmap *) MultiExecProcNode(outerPlanState(node));
@@ -743,16 +753,7 @@ ExecInitBitmapHeapScan(BitmapHeapScan *node, EState *estate, int eflags)
743753
scanstate->shared_tbmiterator = NULL;
744754
scanstate->shared_prefetch_iterator = NULL;
745755
scanstate->pstate = NULL;
746-
747-
/*
748-
* We can potentially skip fetching heap pages if we do not need any
749-
* columns of the table, either for checking non-indexable quals or for
750-
* returning data. This test is a bit simplistic, as it checks the
751-
* stronger condition that there's no qual or return tlist at all. But in
752-
* most cases it's probably not worth working harder than that.
753-
*/
754-
scanstate->can_skip_fetch = (node->scan.plan.qual == NIL &&
755-
node->scan.plan.targetlist == NIL);
756+
scanstate->can_skip_fetch = false;
756757

757758
/*
758759
* Miscellaneous initialization

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.