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

Commit8a45050

Browse files
committed
Tweak order of operations in BitmapHeapNext() to avoid the case of prefetching
the same page we are nanoseconds away from reading for real. There should besomething left to do on the current page before we consider issuing a prefetch.
1 parent405728f commit8a45050

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

‎src/backend/executor/nodeBitmapHeapscan.c

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
*
2222
*
2323
* IDENTIFICATION
24-
* $PostgreSQL: pgsql/src/backend/executor/nodeBitmapHeapscan.c,v 1.33 2009/01/1205:10:44 tgl Exp $
24+
* $PostgreSQL: pgsql/src/backend/executor/nodeBitmapHeapscan.c,v 1.34 2009/01/1216:00:41 tgl Exp $
2525
*
2626
*-------------------------------------------------------------------------
2727
*/
@@ -236,10 +236,22 @@ BitmapHeapNext(BitmapHeapScanState *node)
236236
#endif/* USE_PREFETCH */
237237
}
238238

239+
/*
240+
* Out of range? If so, nothing more to look at on this page
241+
*/
242+
if (scan->rs_cindex<0||scan->rs_cindex >=scan->rs_ntuples)
243+
{
244+
node->tbmres=tbmres=NULL;
245+
continue;
246+
}
247+
239248
#ifdefUSE_PREFETCH
240249
/*
241250
* We issue prefetch requests *after* fetching the current page
242251
* to try to avoid having prefetching interfere with the main I/O.
252+
* Also, this should happen only when we have determined there is
253+
* still something to do on the current page, else we may uselessly
254+
* prefetch the same page we are just about to request for real.
243255
*/
244256
if (prefetch_iterator)
245257
{
@@ -260,15 +272,6 @@ BitmapHeapNext(BitmapHeapScanState *node)
260272
}
261273
#endif/* USE_PREFETCH */
262274

263-
/*
264-
* Out of range? If so, nothing more to look at on this page
265-
*/
266-
if (scan->rs_cindex<0||scan->rs_cindex >=scan->rs_ntuples)
267-
{
268-
node->tbmres=tbmres=NULL;
269-
continue;
270-
}
271-
272275
/*
273276
* Okay to fetch the tuple
274277
*/

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp