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

Commit1577081

Browse files
committed
BitmapHeapScan: begin scan after bitmap creation
Change the order so that the table scan is initialized only afterinitializing the index scan and building the bitmap.This is mostly a cosmetic change for now, but later commits will needto pass parameters to table_beginscan_bm() that are unavailable inExecInitBitmapHeapScan().Author: Melanie PlagemanReviewed-by: Tomas Vondra, Andres Freund, Heikki LinnakangasDiscussion:https://postgr.es/m/CAAKRu_ZwCwWFeL_H3ia26bP2e7HiKLWt0ZmGXPVwPO6uXq0vaA%40mail.gmail.com
1 parent06558f4 commit1577081

File tree

1 file changed

+20
-7
lines changed

1 file changed

+20
-7
lines changed

‎src/backend/executor/nodeBitmapHeapscan.c

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,21 @@ BitmapHeapNext(BitmapHeapScanState *node)
178178
}
179179
#endif/* USE_PREFETCH */
180180
}
181+
182+
/*
183+
* If this is the first scan of the underlying table, create the table
184+
* scan descriptor and begin the scan.
185+
*/
186+
if (!scan)
187+
{
188+
scan=table_beginscan_bm(node->ss.ss_currentRelation,
189+
node->ss.ps.state->es_snapshot,
190+
0,
191+
NULL);
192+
193+
node->ss.ss_currentScanDesc=scan;
194+
}
195+
181196
node->initialized= true;
182197
}
183198

@@ -601,7 +616,8 @@ ExecReScanBitmapHeapScan(BitmapHeapScanState *node)
601616
PlanState*outerPlan=outerPlanState(node);
602617

603618
/* rescan to release any page pin */
604-
table_rescan(node->ss.ss_currentScanDesc,NULL);
619+
if (node->ss.ss_currentScanDesc)
620+
table_rescan(node->ss.ss_currentScanDesc,NULL);
605621

606622
/* release bitmaps and buffers if any */
607623
if (node->tbmiterator)
@@ -678,7 +694,9 @@ ExecEndBitmapHeapScan(BitmapHeapScanState *node)
678694
/*
679695
* close heap scan
680696
*/
681-
table_endscan(scanDesc);
697+
if (scanDesc)
698+
table_endscan(scanDesc);
699+
682700
}
683701

684702
/* ----------------------------------------------------------------
@@ -783,11 +801,6 @@ ExecInitBitmapHeapScan(BitmapHeapScan *node, EState *estate, int eflags)
783801

784802
scanstate->ss.ss_currentRelation=currentRelation;
785803

786-
scanstate->ss.ss_currentScanDesc=table_beginscan_bm(currentRelation,
787-
estate->es_snapshot,
788-
0,
789-
NULL);
790-
791804
/*
792805
* all done.
793806
*/

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp