Chapter 38 — Quiz

13 questions. Answers at the bottom.


Multiple choice

Q1. shared_buffers controls: - A) Max connections - B) The in-memory page cache (buffer pool) size - C) Disk space - D) The WAL

Q2. work_mem is allocated: - A) Once for the whole server - B) Per sort/hash operation (so it multiplies with concurrency) - C) Per table - D) Per backup

Q3. To see queries running right now, use: - A) pg_stat_statements - B) pg_stat_activity - C) pg_dump - D) EXPLAIN

Q4. The best tool to find which queries to optimize (by total time) is: - A) pg_stat_activity - B) pg_stat_statements - C) pg_stat_user_indexes - D) VACUUM

Q5. A logical backup uses: - A) pg_basebackup - B) pg_dump / pg_restore - C) WAL only - D) A snapshot

Q6. Point-In-Time Recovery requires: - A) Only a nightly dump - B) A base backup + archived WAL - C) pg_stat_statements - D) RLS

Q7. PITR lets you recover: - A) Only to last night - B) To any moment (e.g., one minute before a bad DELETE) - C) Nothing - D) Only the schema

Q8. The 3-2-1 backup rule means: - A) 3 backups per day - B) 3 copies, 2 media, 1 off-site - C) 3 servers - D) 2-1 odds

Q9. "A backup you've never restored is:" - A) Sufficient - B) A hope, not a backup - C) Encrypted - D) Automatic

Q10. When the database disk fills up: - A) Nothing happens - B) The database can't write WAL and may halt — a preventable outage - C) Queries speed up - D) Backups run

Q11. For high client counts, instead of raising max_connections to thousands, you should: - A) Buy more RAM only - B) Use a connection pooler (PgBouncer) - C) Disable connections - D) Use NoSQL


True/False

Q12. A major version upgrade (16→17) is just a restart, like a minor upgrade. (True / False)

Q13. Managed database services remove the need to understand configuration, monitoring, and backups. (True / False)


Short answer

Q14. Why is "test your restores regularly" the single most important backup practice?

---

Answer key

Q1 — B. The buffer pool (page cache).

Q2 — B. Per operation — multiplies with concurrency (don't set too high).

Q3 — B. pg_stat_activity.

Q4 — B. pg_stat_statements (aggregated query stats).

Q5 — B. pg_dump/pg_restore.

Q6 — B. Base backup + archived WAL.

Q7 — B. Any moment (the PITR superpower).

Q8 — B. 3 copies, 2 media, 1 off-site.

Q9 — B. A hope, not a backup.

Q10 — B. Can't write WAL → may halt; monitor free space.

Q11 — B. A connection pooler (Ch. 27).

Q12 — False. Major upgrades change the internal format; they need pg_upgrade/dump-restore/logical replication and testing.

Q13 — False. They operate some of it, but you still configure, tune, monitor, and ensure backups exist and restore.

Q14. Because backups fail silently — a misconfigured job, a corrupt file, missing tables, or a process that "succeeds" but produces an unusable backup. You only discover a broken backup when you try to restore it — and if that's during a real disaster, it's too late. Regularly restoring to a scratch environment and verifying the data proves the backup actually works before you need it, turning "we have backups" into "we can actually recover."

Scoring: 12–14 you can operate a database; 9–11 review backups/monitoring; below 9, do the backup-and-restore exercise (C).