toastinfo

show details on toasted datums

Overview

PackageVersionCategoryLicenseLanguage
toastinfo1.5STATPostgreSQLC
IDExtensionBinLibLoadCreateTrustRelocSchema
6530toastinfoNoYesNoYesNoYes-
Relatedpageinspect pg_visibility pgstattuple amcheck pg_relusage pg_buffercache pg_freespacemap pg_repack

Version

TypeRepoVersionPG VerPackageDeps
EXTMIXED1.51817161514toastinfo-
RPMPIGSTY1.51817161514toastinfo_$v-
DEBPGDG1.51817161514postgresql-$v-toastinfo-
OS / PGPG18PG17PG16PG15PG14
el8.x86_64
el8.aarch64
el9.x86_64
el9.aarch64
el10.x86_64
el10.aarch64
d12.x86_64
PGDG 1.5
PGDG 1.5
PGDG 1.5
PGDG 1.5
PGDG 1.5
d12.aarch64
PGDG 1.5
PGDG 1.5
PGDG 1.5
PGDG 1.5
PGDG 1.5
d13.x86_64
PGDG 1.5
PGDG 1.5
PGDG 1.5
PGDG 1.5
PGDG 1.5
d13.aarch64
PGDG 1.5
PGDG 1.5
PGDG 1.5
PGDG 1.5
PGDG 1.5
u22.x86_64
PGDG 1.5
PGDG 1.5
PGDG 1.5
PGDG 1.5
PGDG 1.5
u22.aarch64
PGDG 1.5
PGDG 1.5
PGDG 1.5
PGDG 1.5
PGDG 1.5
u24.x86_64
PGDG 1.5
PGDG 1.5
PGDG 1.5
PGDG 1.5
PGDG 1.5
u24.aarch64
PGDG 1.5
PGDG 1.5
PGDG 1.5
PGDG 1.5
PGDG 1.5

Build

You can build the RPM packages for toastinfo using pig build:

pig build pkg toastinfo         # build RPM packages

Install

You can install toastinfo directly. First, make sure the PGDG and PIGSTY repositories are added and enabled:

pig repo add pgsql -u          # Add repo and update cache

Install the extension using pig or apt/yum/dnf:

pig install toastinfo;          # Install for current active PG version
pig ext install -y toastinfo -v 18  # PG 18
pig ext install -y toastinfo -v 17  # PG 17
pig ext install -y toastinfo -v 16  # PG 16
pig ext install -y toastinfo -v 15  # PG 15
pig ext install -y toastinfo -v 14  # PG 14
dnf install -y toastinfo_18       # PG 18
dnf install -y toastinfo_17       # PG 17
dnf install -y toastinfo_16       # PG 16
dnf install -y toastinfo_15       # PG 15
dnf install -y toastinfo_14       # PG 14
apt install -y postgresql-18-toastinfo   # PG 18
apt install -y postgresql-17-toastinfo   # PG 17
apt install -y postgresql-16-toastinfo   # PG 16
apt install -y postgresql-15-toastinfo   # PG 15
apt install -y postgresql-14-toastinfo   # PG 14

Create Extension:

CREATE EXTENSION toastinfo;

Usage

toastinfo: inspect TOAST storage details of varlena columns

toastinfo exposes the internal storage form of variable-length (varlena) data types, showing how PostgreSQL stores each datum.

Functions

pg_toastinfo(anyelement) – describes the storage form of a datum:

SELECT a, length(b), pg_column_size(b), pg_toastinfo(b), pg_toastpointer(b)
FROM t;

        a         | length  | pg_column_size |              pg_toastinfo              | pg_toastpointer
------------------+---------+----------------+----------------------------------------+-----------------
 null             |       * |              * | null                                   |               *
 default          |       7 |              8 | short inline varlena                   |               *
 external-200     |     200 |            204 | long inline varlena, uncompressed      |               *
 external-10000   |   10000 |          10000 | toasted varlena, uncompressed          |           16427
 extended-10000   |   10000 |            125 | long inline varlena, compressed (pglz) |               *
 extended-1000000 | 1000000 |          11452 | toasted varlena, compressed (pglz)     |           16429
 extended-1000000 | 1000000 |           3936 | toasted varlena, compressed (lz4)      |           16430

Possible storage forms:

  • null – NULL values
  • ordinary – non-varlena datatypes
  • short inline varlena – up to 126 bytes (1-byte header)
  • long inline varlena, (un)compressed – up to 1GiB (4-byte header)
  • toasted varlena, (un)compressed – up to 1GiB stored in TOAST table
  • Compressed varlenas show method (pglz, lz4) on PG14+

pg_toastpointer(anyelement) – returns the chunk_id OID in the TOAST table, or NULL for non-toasted data:

SELECT pg_toastpointer(large_column) FROM my_table;

Last Modified 2026-03-12: add pg extension catalog (95749bf)