Phantom reads Example

Phantom reads Example

Trans.1 Trans.2
SELECT * FROM users
WHERE age BETWEEN 10 AND 30;
INSERT INTO users(id,name,age) 
VALUES ( 3, 'Bob', 27 );
COMMIT;
SELECT * FROM users
WHERE age BETWEEN 10 AND 30;
COMMIT;
Note that Trans.1 executed the same query twice. If the highest level of isolation were maintained, the same set of rows should be returned both times, and indeed that is what is mandated to occur in a database operating at the SQL SERIALIZABLE isolation level. However, at the lesser isolation levels, a different set of rows may be returned the second time.

Следи за CodeGalaxy

Мобильное приложение Beta

Get it on Google Play
Обратная Связь
Продолжайте изучать
сниппеты с SQL
Cosmo
Зарегистрируйся сейчас
или Подпишись на будущие тесты