diff options
| author | Thomas Munro <tmunro@postgresql.org> | 2022-04-07 19:28:40 +1200 |
|---|---|---|
| committer | Thomas Munro <tmunro@postgresql.org> | 2022-04-07 19:42:14 +1200 |
| commit | 5dc0418fab281d017a61a5756240467af982bdfd (patch) | |
| tree | cdcfda92621a9a7cd458999ede8f3974ef2a0bc1 /src/backend/catalog/system_views.sql | |
| parent | 9553b4115f1879f66935f42fff0b798ef91866d0 (diff) | |
| download | postgresql-5dc0418fab281d017a61a5756240467af982bdfd.tar.gz | |
Prefetch data referenced by the WAL, take II.
Introduce a new GUC recovery_prefetch. 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. Since not all OSes have
that system call, "try" is provided so that it can be enabled where
available. Better mechanisms for asynchronous I/O are possible in later
work.
Set to "try" for now for test coverage. Default setting to be finalized
before release.
The GUC wal_decode_buffer_size limits the distance we can look ahead in
bytes of decoded data.
The existing GUC maintenance_io_concurrency is used to limit the number
of concurrent I/Os allowed, based on pessimistic heuristics used to
infer that I/Os have begun and completed. We'll also not look more than
maintenance_io_concurrency * 4 block references ahead.
Reviewed-by: Julien Rouhaud <rjuju123@gmail.com>
Reviewed-by: Tomas Vondra <tomas.vondra@2ndquadrant.com>
Reviewed-by: Alvaro Herrera <alvherre@2ndquadrant.com> (earlier version)
Reviewed-by: Andres Freund <andres@anarazel.de> (earlier version)
Reviewed-by: Justin Pryzby <pryzby@telsasoft.com> (earlier version)
Tested-by: Tomas Vondra <tomas.vondra@2ndquadrant.com> (earlier version)
Tested-by: Jakub Wartak <Jakub.Wartak@tomtom.com> (earlier version)
Tested-by: Dmitry Dolgov <9erthalion6@gmail.com> (earlier version)
Tested-by: Sait Talha Nisanci <Sait.Nisanci@microsoft.com> (earlier version)
Discussion: https://postgr.es/m/CA%2BhUKGJ4VJN8ttxScUFM8dOKX0BrBiboo5uz1cq%3DAovOddfHpA%40mail.gmail.com
Diffstat (limited to 'src/backend/catalog/system_views.sql')
| -rw-r--r-- | src/backend/catalog/system_views.sql | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/backend/catalog/system_views.sql b/src/backend/catalog/system_views.sql index e701d1c676..b1a6df16ad 100644 --- a/src/backend/catalog/system_views.sql +++ b/src/backend/catalog/system_views.sql @@ -930,6 +930,20 @@ CREATE VIEW pg_stat_wal_receiver AS FROM pg_stat_get_wal_receiver() s WHERE s.pid IS NOT NULL; +CREATE VIEW pg_stat_recovery_prefetch AS + SELECT + s.stats_reset, + s.prefetch, + s.hit, + s.skip_init, + s.skip_new, + s.skip_fpw, + s.skip_rep, + s.wal_distance, + s.block_distance, + s.io_depth + FROM pg_stat_get_recovery_prefetch() s; + CREATE VIEW pg_stat_subscription AS SELECT su.oid AS subid, |
