Summary
The pg_stat_recovery_prefetch view will contain only one row. The columns wal_distance, block_distance and io_depth show current values, and the other columns show cumulative counters that can be reset with the pg_stat_reset_shared function.
(Description quoted from the official PostgreSQL documentation.)
Columns
The pg_stat_recovery_prefetch statistics view exposes the following columns (names, types and descriptions are taken verbatim from the PostgreSQL documentation):
stats_resettimestamp with time zone
Time at which these statistics were last resetprefetchbigint
Number of blocks prefetched because they were not in the buffer poolhitbigint
Number of blocks not prefetched because they were already in the buffer poolskip_initbigint
Number of blocks not prefetched because they would be zero-initializedskip_newbigint
Number of blocks not prefetched because they didn’t exist yetskip_fpwbigint
Number of blocks not prefetched because a full page image was included in the WALskip_repbigint
Number of blocks not prefetched because they were already recently prefetchedwal_distanceint
How many bytes ahead the prefetcher is lookingblock_distanceint
How many blocks ahead the prefetcher is lookingio_depthint
How many prefetches have been initiated but are not yet known to have completed
Version applicability
Present in PostgreSQL 17, 18, 19 (verified against each release’s documentation). This is a long-standing system object that also exists in earlier PostgreSQL releases.
Related & references
Reference: PostgreSQL documentation — pg_stat_recovery_prefetch.