190 likes | 405 Views
B+Tree & MVCC @ InnoDB. Wen Mengtian. InnoDB uses B+Tree. B+Tree & MVCC @ InnoDB. Structure of B+Tree. B+Tree & MVCC @ InnoDB. via. B+Tree & MVCC @ InnoDB. via. B+Tree & MVCC @ InnoDB. What is MVCC? Multi-Version Concurrency Control. Why MVCC? Support transaction. Avoid lock .
E N D
B+Tree & MVCC @ InnoDB Wen Mengtian
InnoDB uses B+Tree. B+Tree & MVCC @ InnoDB
Structure of B+Tree B+Tree & MVCC @ InnoDB
via B+Tree & MVCC @ InnoDB
via B+Tree & MVCC @ InnoDB
What is MVCC? Multi-Version Concurrency Control. Why MVCC? Support transaction. Avoid lock. B+Tree & MVCC @ InnoDB
Copy-On-Write? B+Tree & MVCC @ InnoDB
InnoDB supports 4 type of MVCC level. SET GLOBAL TRANSACTION ISOLATION LEVEL REPEATABLE READ; Possible choices: READ UNCOMMITTED | READ COMMITTED REPEATABLE READ | SERIALIZABLE Default: REPEATABLE READ B+Tree & MVCC @ InnoDB
READ UNCOMMITTED Any uncommitted change will be selected. B+Tree & MVCC @ InnoDB
READ COMMITTED Any COMMITTED change will be selected. B+Tree & MVCC @ InnoDB
REPEATABLE READ Any COMMITTED change will NOT be selected. That is, any same selects will give the SAME result. B+Tree & MVCC @ InnoDB
SERIALIZABLE Same as REPEATABLE READ, except for the SELECT. It auto change SELECT to SELECT IN SHARE MODE. (Lock S) B+Tree & MVCC @ InnoDB
ALL THE LEVEL WILL LOCK THE DATA WHEN UPDATE AFTER IT’S: CHANGED OR SELECT FOR UPDATE Cause an X lock is locking. B+Tree & MVCC @ InnoDB
How does all that works? B+Tree & MVCC @ InnoDB
via B+Tree & MVCC @ InnoDB
See: B+Tree index structures in InnoDB By Jeremy Cole 深入MySQL内核By 网易何登成 淘宝网综合业务平台团队博客 MySQL :: Developer Zone Simple guide of MVCC and relative By 陈剑雄 And more. B+Tree & MVCC @ InnoDB
Thank you. Q&A. B+Tree & MVCC @ InnoDB