Skip to main content
InterviewHubPRO
Section Overview
Q23

Question 23 of 50

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

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

How do you analyze `EXPLAIN (ANALYZE, BUFFERS)` output?

senior LevelpostgresqlAdvanced Internals

In Simple Words: Always include BUFFERS when tuning queries in PostgreSQL:

  • Shows the actual execution time, rows returned, and memory/disk page interactions:
    • Seq Scan: Full sequential table scan (investigate if table is large).
    • Index Scan: Navigates B-Tree, fetches row tuples from table heap.
    • Index Only Scan: The query is completely satisfied by the index (requires index covering and low dead tuples in the Visibility Map).
    • Bitmap Index Scan: Collects matching page pointers into a bitmap in memory, then fetches table pages in physical disk order (faster sequential I/O).
    • Buffers: shared hit=42 read=5: 42 pages found in RAM, 5 pages read from disk.