# aneasystone/mysql-deadlocks

收集一些常见的 MySQL 死锁案例

Repository: https://github.com/aneasystone/mysql-deadlocks
Canonical: https://ross.abutalabs.com/products/mysql-deadlocks
Language: PLpgSQL
License Family: other
Last push: 2020-07-21T07:20:46+00:00

## Health v2 (maintenance only)
Score: 32/100 (v2, computed 2026-09-02T17:46:02.011165+00:00)
- activity 0, release rhythm 35, longevity 100
- inputs: {"age_days": 3082, "days_push": 2234, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: no_releases, no_license
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1492, forks 323 (observed 2026-08-28T04:04:52.579349+00:00)

## What it is
A curated collection of common MySQL deadlock cases, each analyzed from deadlock logs with reproduction steps, table schemas, and explanations of the locks involved. Cases are classified by the SQL statements each transaction executes and the locks they wait for or hold.

## Use cases
- understand why two inserts caused a deadlock in MySQL
- analyze InnoDB deadlock log output
- reproduce a gap lock deadlock scenario
- learn how insert intention locks and gap locks interact
- troubleshoot 'lock_mode X locks rec but not gap' errors
- study real-world MySQL transaction locking examples

## When to choose
- debugging or preventing MySQL/InnoDB deadlocks
- learning how InnoDB row, gap, and intention locks work
- training database engineers on concurrency issues

## When to avoid
- you need deadlock handling for PostgreSQL, SQL Server, or other databases
- you want an automated deadlock detection or resolution tool
- you need actively maintained, up-to-date content

## Facets
- artifact type: learning-resource
- maturity: maintenance
- function: database, documentation
- domain: databases, tutorials, developer-tools
- platform: -
- tags: mysql, deadlock, innodb, locking, case-studies, database-internals, chinese

## Member repositories
- aneasystone/mysql-deadlocks (main) score 32

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:04:52.579349+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T04:33:28.992527+00:00, confidence not recorded.
  - readme: https://github.com/aneasystone/mysql-deadlocks (fetched 2026-08-28T04:04:52.579349+00:00, sha e6cab0eee9f2)
- Data as of 2026-08-30T08:39:29.467469+00:00.
