Part 2 of 5 · 1 min read
Timestamp ordering
Every transaction gets a timestamp at the start, and every operation is checked against the timestamps of transactions that already touched the same data.
Think of a shared logbook where every entry must be written strictly in the order its author arrived. Anyone who tries to insert an entry out of that arrival order is simply turned away.
In plain words: timestamp ordering assigns each transaction a unique timestamp when it begins, reflecting its starting order. Every data item remembers the timestamp of the most recent transaction that read it and the most recent transaction that wrote it. When a transaction attempts an operation, the protocol checks whether that operation would violate the timestamp order, such as a transaction trying to write a value that a later-timestamped transaction has already read; if so, the attempting transaction is rejected and must restart with a new timestamp, rather than being made to wait.
A worked example. If transaction A, with an earlier timestamp, attempts to write a row that transaction B, with a later timestamp, has already read, timestamp ordering rejects A's write, since allowing it would make B's earlier read inconsistent with the required timestamp order.
The key lines. No new SQL; timestamp ordering is an internal protocol some databases use instead of locking, operating transparently underneath ordinary transaction statements.
Timestamp ordering
Timestamp ordering assigns each transaction a unique starting timestamp and rejects, rather than delays, any operation that would violate the required order between transactions' timestamps on a shared data item.
Example: a logbook rejecting any entry written out of its author's actual arrival order mirrors timestamp ordering rejecting an out-of-order operation.