Subject Re: [firebird-support] Re: Store Blobs in Seperate Tables?
Author Ann W. Harrison
Adam wrote:
> Updating or deleting a record puts a lock on that record that prevents
> any other transaction modifying it until you commit or rollback
> (obviously it doesn't affect selects, because writers dont block
> readers).

Just for the sake of absolute and pedantic correctness, updating (or
inserting or deleting) a record doesn't put a "lock" on it. These
operations create a new version of the record (the first, in the case of
inserts) which carries the transaction id of the transaction that
created the version. Thus a single record that had been updated four
times would have five versions, each with the transaction id of the
transaction that created it. When a transaction starts to modify (or
delete) a record, it checks the transaction id on the most recent
version. If that transaction was not committed when the new update
transaction started (if the new updater is a concurrency or snapshot
transaction) or is not committed yet (if the new updater is
read-committed transactions), then the update fails (no-wait updater) or
waits (wait updater) until the transaction that created the most recent
version commits or rolls back.