Skip to main content
InterviewHubPRO
Section Overview
Q42

Question 42 of 50

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

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

PostgreSQL `EXPLAIN (ANALYZE, BUFFERS)` Execution Plans.

senior LevelDatabases & SQLPostgreSQL

In Simple Words:

  • EXPLAIN: Shows the planner's estimated cost without running the query.
  • EXPLAIN (ANALYZE, BUFFERS): Actually executes the query, showing true execution runtime ($ms$) and exact disk buffer usage:
    • Seq Scan: Scans the entire table sequentially (slow for large tables).
    • Index Scan: Traverses B-tree and fetches matching heap pages.
    • Bitmap Index Scan / Bitmap Heap Scan: Creates a bitmap of matching pages from the index and reads heap pages in sequential physical disk order.
    • Buffers: shared hit=400 read=10: Indicates 400 pages read from RAM cache, 10 read from disk.