Master concurrency and locking in PostgreSQL with this collection of 30 multiple-choice questions. Explore advanced locking mechanisms, deadlock resolution, MVCC internals, and performance tuning to optimize your PostgreSQL experience.
| Qno | Answer |
|---|---|
| 1 | D) Access share lock |
| 2 | B) Access exclusive lock |
| 3 | B) Locks the selected rows for update |
| 4 | B) Row exclusive lock |
| 5 | C) Prevents other transactions from locking the rows for exclusive access |
| 6 | A) Row exclusive lock |
| 7 | B) Causes the transaction to fail immediately if a lock cannot be acquired |
| 8 | A) Access share lock |
| 9 | B) Access exclusive lock |
| 10 | B) SELECT * FROM pg_locks |
| 11 | B) Two transactions cannot proceed because each is waiting for the other to release a lock |
| 12 | D) Reading data without acquiring locks |
| 13 | C) By checking for circular dependencies between transactions |
| 14 | B) It rolls back one transaction to resolve the deadlock |
| 15 | B) Rolling back the transaction that requested the lock last |
| 16 | B) pg_locks |
| 17 | A) Serializable |
| 18 | B) By acquiring locks in the same order in all transactions |
| 19 | B) Rolls back one of the conflicting transactions |
| 20 | A) deadlock_timeout |
| 21 | A) Multiple transactions to read the same data at the same time |
| 22 | B) By storing multiple versions of a row in the table |
| 23 | B) pg_class |
| 24 | B) The row version becomes visible to other transactions |
| 25 | C) Read Committed |
| 26 | A) Reduced need for locks during reads |
| 27 | B) By creating new row versions and marking old ones as obsolete |
| 28 | A) By storing separate snapshots for each transaction |
| 29 | A) They are automatically removed during VACUUM |
| 30 | B) VACUUM |