Seconds_Behind_Source is the most quoted and least trusted replication metric in MySQL. This deep dive covers heartbeat-based lag measurement, multi-threaded replica tuning, and the big-transaction lag pattern.
Database Topic Archive
MySQL Articles
InnoDB internals, replication, locking, query performance, and MySQL operations notes.
Replication filters diverge replicas without raising a single error, and source-side filters quietly gut your point-in-time recovery. Here is how each layer actually fails.
A replica that cannot survive kill -9 is a replica you rebuild at 3 a.m. This covers relay_log_recovery, the repository history that made replicas crash-safe, GTID auto-positioning, and why you should crash replicas on purpose.
A crashed replica can come back looking perfectly healthy while quietly diverging. Here is the position-tracking machinery, the replay and skip failure modes, and the config that makes crashes boring.
innodb_redo_log_capacity replaced the old log file settings in 8.0.30. Checkpoint age, the async and sync flush thresholds, and the counters that warn you before a write burst stalls the server.
InnoDB skips transaction bookkeeping for known read-only transactions — but an open read view still pins purge. The autocommit=0 ORM trap, replica read-only flags, and how to measure the win.
Prepared statements are per-connection state with a server-wide cap. Prepared_stmt_count, error 1461, the ORM leak pattern, and why per-query prepare is the worst of both protocols.
Partitioning solves data-lifecycle problems, not performance problems. Field notes on verifying pruning, automating partition maintenance, living with the foreign-key restriction, and knowing when to say no.
You partitioned the table by month and the queries got no faster, because EXPLAIN still lists all 48 partitions in the plan. Here is why pruning fails and the rewrites that bring it back.
EXPLAIN tells you which plan MySQL chose; optimizer_trace tells you which plans it rejected and why. Per-session capture, reading considered_execution_plans, cost numbers, truncation traps, and a worked wrong-index case.