From 1d257577e08d3e598011d6850fd1025858de8c8c Mon Sep 17 00:00:00 2001 From: Thomas Munro Date: Thu, 8 Apr 2021 23:03:43 +1200 Subject: Optionally prefetch referenced data in recovery. Introduce a new GUC recovery_prefetch, disabled by default. When enabled, look ahead in the WAL and try to initiate asynchronous reading of referenced data blocks that are not yet cached in our buffer pool. For now, this is done with posix_fadvise(), which has several caveats. Better mechanisms will follow in later work on the I/O subsystem. The GUC maintenance_io_concurrency is used to limit the number of concurrent I/Os we allow ourselves to initiate, based on pessimistic heuristics used to infer that I/Os have begun and completed. The GUC wal_decode_buffer_size is used to limit the maximum distance we are prepared to read ahead in the WAL to find uncached blocks. Reviewed-by: Alvaro Herrera (parts) Reviewed-by: Andres Freund (parts) Reviewed-by: Tomas Vondra (parts) Tested-by: Tomas Vondra Tested-by: Jakub Wartak Tested-by: Dmitry Dolgov <9erthalion6@gmail.com> Tested-by: Sait Talha Nisanci Discussion: https://postgr.es/m/CA%2BhUKGJ4VJN8ttxScUFM8dOKX0BrBiboo5uz1cq%3DAovOddfHpA%40mail.gmail.com --- src/backend/utils/misc/postgresql.conf.sample | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/backend/utils/misc/postgresql.conf.sample') diff --git a/src/backend/utils/misc/postgresql.conf.sample b/src/backend/utils/misc/postgresql.conf.sample index ff9fa006fef..9830cfe382e 100644 --- a/src/backend/utils/misc/postgresql.conf.sample +++ b/src/backend/utils/misc/postgresql.conf.sample @@ -235,6 +235,12 @@ #checkpoint_flush_after = 0 # measured in pages, 0 disables #checkpoint_warning = 30s # 0 disables +# - Prefetching during recovery - + +#wal_decode_buffer_size = 512kB # lookahead window used for prefetching +#recovery_prefetch = off # prefetch pages referenced in the WAL? +#recovery_prefetch_fpw = off # even pages logged with full page? + # - Archiving - #archive_mode = off # enables archiving; off, on, or always -- cgit v1.2.3