summaryrefslogtreecommitdiff
path: root/src/include/access/heapam.h
diff options
context:
space:
mode:
authorThomas Munro2024-04-07 13:48:27 +0000
committerThomas Munro2024-04-07 13:53:57 +0000
commitb7b0f3f27241e424b7103397489464d907cef2c4 (patch)
tree0153cde8bc66f088b4d33921d4ebfe808c814972 /src/include/access/heapam.h
parent6ed83d5fa55cf6e6c9d1be34ec10730c48eba763 (diff)
Use streaming I/O in sequential scans.
Instead of calling ReadBuffer() for each block, heap sequential scans and TID range scans now use the streaming API introduced in b5a9b18cd0. Author: Melanie Plageman <[email protected]> Reviewed-by: Andres Freund <[email protected]> Reviewed-by: Thomas Munro <[email protected]> Discussion: https://postgr.es/m/flat/CAAKRu_YtXJiYKQvb5JsA2SkwrsizYLugs4sSOZh3EAjKUg%3DgEQ%40mail.gmail.com
Diffstat (limited to 'src/include/access/heapam.h')
-rw-r--r--src/include/access/heapam.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/include/access/heapam.h b/src/include/access/heapam.h
index 750ea30852e..48936826bcc 100644
--- a/src/include/access/heapam.h
+++ b/src/include/access/heapam.h
@@ -25,6 +25,7 @@
#include "storage/bufpage.h"
#include "storage/dsm.h"
#include "storage/lockdefs.h"
+#include "storage/read_stream.h"
#include "storage/shm_toc.h"
#include "utils/relcache.h"
#include "utils/snapshot.h"
@@ -70,6 +71,20 @@ typedef struct HeapScanDescData
HeapTupleData rs_ctup; /* current tuple in scan, if any */
+ /* For scans that stream reads */
+ ReadStream *rs_read_stream;
+
+ /*
+ * For sequential scans and TID range scans to stream reads. The read
+ * stream is allocated at the beginning of the scan and reset on rescan or
+ * when the scan direction changes. The scan direction is saved each time
+ * a new page is requested. If the scan direction changes from one page to
+ * the next, the read stream releases all previously pinned buffers and
+ * resets the prefetch block.
+ */
+ ScanDirection rs_dir;
+ BlockNumber rs_prefetch_block;
+
/*
* For parallel scans to store page allocation data. NULL when not
* performing a parallel scan.