DB Internals AtlasPostgreSQL 18.6 Home About

Parameter · Preset Options

block_size

Shows the size of a disk block.

  • Default: 8192
  • Type: integer
  • Range: 8192 … 8192
  • Applies: Read-only

In plain words

PostgreSQL stores tables and indexes in fixed-size pages (blocks). Almost every installation uses 8 kB. All reads, writes, caching and WAL full-page images happen in units of this size.

For DBAs and operators

Chosen with configure --with-blocksize (1–32 kB, power of two) and baked into the binaries and the data directory; you cannot change it without a new build, initdb and a dump/restore. Practically every packaged build uses 8192.

Things derived from it: the maximum row size before TOAST kicks in (~2 kB, a quarter page), units of shared_buffers, effective_cache_size and the 8kB unit in pg_settings, relpages, and the page numbers in error messages like ERROR: invalid page in block 4 of relation "base/16384/16385". Table size = relpages × block_size:

SELECT relname, relpages, relpages * current_setting('block_size')::int AS bytes
  FROM pg_class ORDER BY relpages DESC LIMIT 5;

How to change it

Fixed when PostgreSQL was built or the cluster was initialised. You can only read it.

See it in context

Page layout Physical layout on disk TOAST

Related parameters

wal_block_size segment_size shared_buffers data_checksums

All Preset Options parameters