↑↓ select ↵ open ⌫ change scope Open full search

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

Functions / System Administration Functions

pg_size_pretty

Read the PG 18 manual

Converts a size in bytes into a more easily human-readable format with size units (bytes, kB, MB, GB, TB, or PB as appropriate).

Reading PG 18current·documented in 22 of 27 versions, 8.1 to 20

Signatures & examples

pg_size_pretty ( bigint ) → text
Converts a size in bytes into a more easily human-readable format with size units (bytes, kB, MB, GB, TB, or PB as appropriate). Note that the units are powers of 2 rather than powers of 10, so 1kB is 1024 bytes, 1MB is 10242 = 1048576 bytes, and so on.
pg_size_pretty ( numeric ) → text
Converts a size in bytes into a more easily human-readable format with size units (bytes, kB, MB, GB, TB, or PB as appropriate). Note that the units are powers of 2 rather than powers of 10, so 1kB is 1024 bytes, 1MB is 10242 = 1048576 bytes, and so on.
Version history 4
  1. 14 → 15 changed
  2. 12 → 13 changed
  3. 9.1 → 9.2 changed
  4. 8.0 → 8.1 added

Definition snapshot: b7bd9cda · English manual source