pg_stat_recovery_prefetch — PostgreSQL statistics view

The PostgreSQL pg_stat_recovery_prefetch statistics view: full column reference (names, types, descriptions), catalog relationships and version support.

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_reset timestamp with time zone
    Time at which these statistics were last reset
  • prefetch bigint
    Number of blocks prefetched because they were not in the buffer pool
  • hit bigint
    Number of blocks not prefetched because they were already in the buffer pool
  • skip_init bigint
    Number of blocks not prefetched because they would be zero-initialized
  • skip_new bigint
    Number of blocks not prefetched because they didn’t exist yet
  • skip_fpw bigint
    Number of blocks not prefetched because a full page image was included in the WAL
  • skip_rep bigint
    Number of blocks not prefetched because they were already recently prefetched
  • wal_distance int
    How many bytes ahead the prefetcher is looking
  • block_distance int
    How many blocks ahead the prefetcher is looking
  • io_depth int
    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.