Explain ACID and isolation levels
Company: Meta
Role: Software Engineer
Category: Software Engineering Fundamentals
Difficulty: medium
Interview Round: Onsite
Explain what a database transaction is, define the ACID properties (Atomicity, Consistency, Isolation, Durability), and describe common transaction isolation levels: Read Uncommitted, Read Committed, Repeatable Read, and Serializable.
For each isolation level, discuss:
- Which anomalies it prevents or allows (e.g., dirty reads, non-repeatable reads, phantom reads).
- A concrete example scenario illustrating those anomalies.
- When you might choose that level in a real-world application (e.g., financial system vs. analytics system).
Also explain how isolation relates to performance and concurrency in a database system.
Quick Answer: This question evaluates a candidate's knowledge of database transactions, the ACID properties (Atomicity, Consistency, Isolation, Durability), and common isolation levels (Read Uncommitted, Read Committed, Repeatable Read, Serializable), testing competency in concurrency control and data consistency.