1
0
mirror of https://github.com/postgres/postgres.git synced 2025-10-22 14:32:25 +03:00

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 <melanieplageman@gmail.com>
Reviewed-by: Andres Freund <andres@anarazel.de>
Reviewed-by: Thomas Munro <thomas.munro@gmail.com>
Discussion: https://postgr.es/m/flat/CAAKRu_YtXJiYKQvb5JsA2SkwrsizYLugs4sSOZh3EAjKUg%3DgEQ%40mail.gmail.com
This commit is contained in:
Thomas Munro
2024-04-08 01:48:27 +12:00
parent 6ed83d5fa5
commit b7b0f3f272
2 changed files with 180 additions and 76 deletions

View File

@@ -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.