Serializability

Опубликовано: 10 Февраль 2025
на канале: Data Science Center
176
14

A schedule in which conflicting operations are in a serial order.

Processing transactions using a serializable schedule will give the same results as if the transactions had been processed one after the other.

Schedules are designed so that transactions that will not interfere with each other can still be run in parallel.
Objective of a concurrency control protocol is to schedule transactions in such a way as to avoid any interference.
Could run transactions serially, but this limits degree of concurrency or parallelism in system.
Nonserial Schedule
Schedule where operations from set of concurrent transactions are interleaved.
Objective of serializability is to find nonserial schedules that allow transactions to execute concurrently without interfering with one another.
In other words, want to find nonserial schedules that are equivalent to some serial schedule. Such a schedule is called serializable.

In serializability, ordering of read/writes is important:

If two transactions only read a data item, they do not conflict and order is not important.

If two transactions either read or write completely separate data items, they do not conflict and order is not important.

If one transaction writes a data item and another reads or writes same data item, order of execution is important.
Read Committed Isolation Level

Every query executed by a transaction sees only data committed.

Transection Level

Session Level

ALTER SESSION SET ISOLATION_LEVEL READ COMMITTED;

Serializable Isolation Level

Serializable transactions see only those changes that were committed at the time the transaction began, plus those changes made by the transaction itself through INSERT, UPDATE, and DELETE statements.

Transaction Level
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;

Session Level
ALTER SESSION SET ISOLATION_LEVEL SERIALIZABLE;



Read Only

Read-only transactions see only those changes that were committed at the time the transaction began and do not allow INSERT,  UPDATE, and DELETE statements.

Transaction Level
SET TRANSACTION READ ONLY;

Session Level
ALTER SESSION SET ISOLATION_LEVEL READONLY;