Skip to main content
InterviewHubPRO
Section Overview
Q22

Question 22 of 50

Part 3: Advanced Internals, Scale & Production Patterns (Senior / Lead)

44%
PostgreSQL Enterprise (50 Qs)•Part 3: Advanced Internals, Scale & Production Patterns (Senior / Lead)

What is TOAST (The Oversized-Attribute Storage Technique)?

senior LevelMost AskedpostgresqlAdvanced Internals

In Simple Words: PostgreSQL pages have a fixed size of 8 KB, and rows cannot span across multiple pages:

  • If a column value (e.g. a large text document or JSONB) exceeds 2 KB:
  • PostgreSQL automatically triggers TOAST:
    1. Compresses the large attribute value.
    2. If still too large, moves the data out-of-line into a hidden auxiliary TOAST table, chunking it into 2 KB pieces.
    3. Replaces the attribute in the main table with a 18-byte TOAST pointer.
  • Standard queries that do not select the large column never read the TOAST table, preserving cache efficiency!