#endif /* USE_PREFETCH */
}
+ /*
+ * Out of range? If so, nothing more to look at on this page
+ */
+ if (scan->rs_cindex < 0 || scan->rs_cindex >= scan->rs_ntuples)
+ {
+ node->tbmres = tbmres = NULL;
+ continue;
+ }
+
#ifdef USE_PREFETCH
/*
* We issue prefetch requests *after* fetching the current page
* to try to avoid having prefetching interfere with the main I/O.
+ * Also, this should happen only when we have determined there is
+ * still something to do on the current page, else we may uselessly
+ * prefetch the same page we are just about to request for real.
*/
if (prefetch_iterator)
{
}
#endif /* USE_PREFETCH */
- /*
- * Out of range? If so, nothing more to look at on this page
- */
- if (scan->rs_cindex < 0 || scan->rs_cindex >= scan->rs_ntuples)
- {
- node->tbmres = tbmres = NULL;
- continue;
- }
-
/*
* Okay to fetch the tuple
*/