Row-based Replication was introduced in MySQL 5.1. It’s not the
default (yet), but I really like it. I wanted to tell you what
limitations you may face with statement-based, and why you should
join me in making the switch.
Write scalability of certain statements
Statement based binary logging requires additional locking to ensure
slave-consistency. To illustrate, here is a naive example:
CREATE TABLE users (
user_id INT NOT NULL primary key,
user_name varchar(60) NOT NULL,
is_deleted TINYINT DEFAULT 0,
UNIQUE KEY(user_name)
);
INSERT INTO users (user_id, user_name, is_deleted) VALUES
(1, 'ted', 0),
(2, 'bill', 0),
(3, 'fred', 0),
(4, 'mike', 1),
(5, 'barry', 0);
session1> START TRANSACTION;
session1> DELETE FROM users WHERE is_deleted = 1; # 1 row matches (user_id 4), deleted.
session2> START TRANSACTION; …
[Read more]