AI engineering glossary · SQL databases
What is phantom read?
Phantom read: An anomaly where the same query run twice inside a transaction returns different sets of rows because another transaction inserted or deleted matching rows in between. It affects sets of rows rather than one row.
Phantom read: an example
Counting orders over ₹1,000 gives 40, then 41 in the same transaction after someone commits a new large order.
Related terms
More SQL databases terms
- PostgreSQL
- Primary key
- Query optimizer
- RANK and DENSE_RANK
- Recursive CTE
- Referential integrity
- Relational algebra
- Relational database
Where you learn it
Phantom read is part of the AI Engineering Program, which teaches it with notes, a hands-on lab and an exam. The first lesson is free.