How can two people both appear to book the last place?
Two booking requests can each read “one place available” before either updates the record. Making each request all-or-nothing does not by itself resolve every interaction between them. Database isolation concerns how simultaneous work fits together, and a rejected request may need to recheck the situation before trying again.
Questions you could explore
- Why is one complete transaction different from a safe combination of concurrent transactions?
Start reading
- PostgreSQL Global Development GroupPostgreSQL 18 Documentation, 13.2 Transaction Isolation
PostgreSQL 18 documentation explains serialization anomalies and serializable isolation.
- PostgreSQL Global Development GroupPostgreSQL 18 Documentation, 3.4 Transactions
The transaction tutorial explains atomicity, visibility, and commit or rollback.
Ready to try your ideas aloud?
Your topic carries over. Record up to 2½ minutes, depending on your plan.