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 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).

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 3
  1. PG 14 → 15changed
  2. PG 12 → 13changed
  3. PG 9.1 → 9.2changed

Definition snapshot: 2026-09-14T13:14:25.684213+00:00@99e6866c · English manual source