How InnoDB resolves opposing row locks by rolling one transaction back

InnoDB deadlocks roll back the whole victim transaction

An InnoDB deadlock occurs when transactions form a cycle of incompatible lock requests. With deadlock detection enabled, InnoDB chooses a victim and rolls back that entire transaction so another participant can proceed. The application receives error 1213 with SQLSTATE 40001. Retrying only the statement that reported the error omits earlier work that was rolled back with it. ...

April 20, 2028 · 4 min · XB Field Notes
An index that carries enough columns to satisfy the whole query

InnoDB covering indexes carry the query's columns

A covering index contains the columns needed to evaluate a particular query and return its requested values. In InnoDB, secondary-index records also carry the primary-key columns, so a query can be covered without explicitly listing the primary key again in the secondary-index definition. Coverage is a relationship between one query and an index, not a permanent property that applies to every query against the table. ...

March 3, 2028 · 4 min · XB Field Notes