↑↓ select↵ open⌫ change scopeOpen full search

PG.CENTER connects PostgreSQL documentation, reference, and ecosystem knowledge. Maintained by Pigsty.

Wiki / System Catalogs

pg_stat_io

The pg_stat_io view will contain one row for each combination of backend type, target I/O object, and I/O context, showing cluster-wide I/O statistics. Combinations which do not make sense are omitted. Currently, I/O on relations (e.g. tables, indexes) and WAL activity are tracked. However, relation I/O which bypasses shared buffers (e.g. when moving a table from one tablespace to another) is currently not tracked.

English manual coverage begins with PostgreSQL 7.4. Source history and runtime observations have their own recorded version boundaries.

Reading PG 18·Select a recorded version

kind
statistics
lang
en
measured attributes
true
metadata release
18.6
runtime columns
backend_type, object, context, reads, read_bytes, read_time, writes, write_bytes, write_time, writebacks, writeback_time, extends, extend_bytes, extend_time, hits, evictions, reuses, fsyncs, fsync_time, stats_reset
runtime verified
false
source
english-manual

Definition PG 18

The pg_stat_io view will contain one row for each combination of backend type, target I/O object, and I/O context, showing cluster-wide I/O statistics. Combinations which do not make sense are omitted. Currently, I/O on relations (e.g. tables, indexes) and WAL activity are tracked. However, relation I/O which bypasses shared buffers (e.g. when moving a table from one tablespace to another) is currently not tracked.

Catalog columns

ColumnTypeNullabilityDescription
backend_typetextNullableType of backend (e.g. background worker, autovacuum worker). See pg_stat_activity for more information on backend_types. Some backend_types do not accumulate I/O operation statistics and will not be included in the view.
objecttextNullableTarget object of an I/O operation. Possible values are: relation: Permanent relations. temp relation: Temporary relations. wal: Write Ahead Logs.
contexttextNullableThe context of an I/O operation. Possible values are: normal: The default or standard context for a type of I/O operation. For example, by default, relation data is read into and written out from shared buffers. Thus, reads and writes of relation data to and from shared buffers are tracked in context normal. init: I/O operations performed while creating the WAL segments are tracked in context init. vacuum: I/O operations performed outside of shared buffers while vacuuming and analyzing permanent relations. Temporary table vacuums use the same local buffer pool as other temporary table I/O operations and are tracked in context normal. bulkread: Certain large read I/O operations done outside of shared buffers, for example, a sequential scan of a large table. bulkwrite: Certain large write I/O operations done outside of shared buffers, such as COPY.
readsbigintNullableNumber of read operations.
read_bytesnumericNullableThe total size of read operations in bytes.
read_timedouble precisionNullableTime spent waiting for read operations in milliseconds (if track_io_timing is enabled and object is not wal, or if track_wal_io_timing is enabled and object is wal, otherwise zero)
writesbigintNullableNumber of write operations.
write_bytesnumericNullableThe total size of write operations in bytes.
write_timedouble precisionNullableTime spent waiting for write operations in milliseconds (if track_io_timing is enabled and object is not wal, or if track_wal_io_timing is enabled and object is wal, otherwise zero)
writebacksbigintNullableNumber of units of size BLCKSZ (typically 8kB) which the process requested the kernel write out to permanent storage.
writeback_timedouble precisionNullableTime spent waiting for writeback operations in milliseconds (if track_io_timing is enabled, otherwise zero). This includes the time spent queueing write-out requests and, potentially, the time spent to write out the dirty data.
extendsbigintNullableNumber of relation extend operations.
extend_bytesnumericNullableThe total size of relation extend operations in bytes.
extend_timedouble precisionNullableTime spent waiting for extend operations in milliseconds. (if track_io_timing is enabled and object is not wal, or if track_wal_io_timing is enabled and object is wal, otherwise zero)
hitsbigintNullableThe number of times a desired block was found in a shared buffer.
evictionsbigintNullableNumber of times a block has been written out from a shared or local buffer in order to make it available for another use. In context normal, this counts the number of times a block was evicted from a buffer and replaced with another block. In contexts bulkwrite, bulkread, and vacuum, this counts the number of times a block was evicted from shared buffers in order to add the shared buffer to a separate, size-limited ring buffer for use in a bulk I/O operation.
reusesbigintNullableThe number of times an existing buffer in a size-limited ring buffer outside of shared buffers was reused as part of an I/O operation in the bulkread, bulkwrite, or vacuum contexts.
fsyncsbigintNullableNumber of fsync calls. These are only tracked in context normal.
fsync_timedouble precisionNullableTime spent waiting for fsync operations in milliseconds (if track_io_timing is enabled and object is not wal, or if track_wal_io_timing is enabled and object is wal, otherwise zero)
stats_resettimestamp with time zoneNullableTime at which these statistics were last reset.

Compare versions

Complete source facts

documentation revision

{"inputs":[{"file":"monitoring-stats.html","kind":"same-version-reviewed-manual","locale":"en","sha256":"a97e4aa05484b41cec1f4c9b0b9c5a083596a056982e5d5ba0db1dd8d49961fb","version":"18.7"},{"file":"monitoring-stats.html","kind":"same-version-reviewed-manual","locale":"zh-Hans","sha256":"1ddb6576fe569e029a1c776c82e7add6be8e4f41705bcd8f66f4347fe23372b6","version":"18.7"}],"release":"18.7","runtime_remeasured":false,"source_revision":"pgdoc:b9f0e7232f60f380d642ac9b99226606c254b552"}

Source references

Full definition and evidence JSON

Definition sources

center · PostgreSQL 18 · catalog-bilingual-repair:d0f1c7940dd0dc24597e9c48c2302f4f2c84a4a3532a9fa7f427ff26705f5c74

Text language: en · catalog-bilingual-repair:d0f1c7940dd0dc24597e9c48c2302f4f2c84a4a3532a9fa7f427ff26705f5c74