Bird
0
0

After deleting many rows from a PostgreSQL table, why is it necessary to run VACUUM?

easy📝 Conceptual Q2 of 15
PostgreSQL - Transactions and Concurrency
After deleting many rows from a PostgreSQL table, why is it necessary to run VACUUM?
ATo immediately remove the deleted rows from the disk permanently.
BTo mark the space occupied by deleted rows as reusable for future inserts or updates.
CTo rebuild all indexes on the table automatically.
DTo compress the table data to reduce disk usage.
Step-by-Step Solution
Solution:
  1. Step 1: Understand what happens after DELETE

    Deleted rows remain as dead tuples until VACUUM marks their space reusable.
  2. Step 2: Analyze options

    VACUUM does not immediately remove rows from disk (B), rebuild indexes (C), or compress data (D).
  3. Final Answer:

    To mark the space occupied by deleted rows as reusable for future inserts or updates. -> Option B
  4. Quick Check:

    VACUUM frees space logically, not physically removing rows instantly [OK]
Quick Trick: VACUUM frees space for reuse after deletes [OK]
Common Mistakes:
  • Assuming VACUUM deletes rows physically immediately
  • Confusing VACUUM with REINDEX or compression commands

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes