DB Internals AtlasPostgreSQL 18.6 Home About

Parameter · Preset Options

segment_size

Shows the number of pages per disk file.

  • Default: 1GB
  • Type: integer (8kB)
  • Range: 1GB … 1GB
  • Applies: Read-only

In plain words

Large tables are not stored as one giant file. PostgreSQL splits each table and index into 1 GB pieces called segments: 16385, 16385.1, 16385.2 and so on.

For DBAs and operators

Shown in pages (131072 × 8 kB = 1 GB). Set at compile time with configure --with-segsize (GB) or, mainly for testing, --with-segsize-blocks; changing it needs a new build and initdb. The split exists for filesystems with file size limits and keeps per-file operations (fsync, truncation of a segment) bounded.

Support tips: files named <relfilenode>.N are normal, not orphans; a missing middle segment means corruption (ERROR: could not open file "base/16384/16385.3" (target block 393216): No such file or directory); free space map and visibility map forks are separate files (_fsm, _vm).

SELECT pg_relation_filepath('orders');   -- base/16384/16385
-- then: ls -l $PGDATA/base/16384/16385*

How to change it

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

See it in context

Physical layout on disk

Related parameters

block_size wal_segment_size

All Preset Options parameters