Skip to content

Lab 12 — Maintenance

Scenario

Table statistics expose live and dead tuple estimates plus vacuum and analyze history. The goal is to determine whether maintenance debt contributes to degraded plans or storage behavior.

Run the exercise

make shell
\i sql/labs/12-maintenance/bad_queries.sql

Investigate

  1. Compare dead tuples with table size and update activity.
  2. Check the recency of vacuum, autovacuum, and analyze operations.
  3. Distinguish stale statistics, dead tuples, and physical bloat.
  4. Gather stronger evidence before prescribing VACUUM FULL or reindexing.
  5. Explain lock, disk-space, WAL, and runtime implications of remediation.

Diagnostic question

Which table warrants deeper maintenance investigation, and what additional evidence is required before choosing a corrective operation?

Previous: Concurrency · Next: Advanced execution