43. ネクストキーロック
• tx1 select * from test where id < 3 for update;
• tx2 update test set name = 'c2' where id = 3;
• tx2 は、lock wating
必ずしも更新対象行のみ
がロックされるわけでは
ないという話
プライマリインデックス 範囲検索
44. ネクストキーロック
• tx1 select * from test where name = 'b' for update;
• txt2 update test set name = 'a2' where name = 'a';
• lock waiting
• tx2 update test set name = 'c2' where name = 'c';
• lock されることなく処理できる
• tx2 update test set name = 'b' where name = 'c';
• lock waiting
非ユニークインデックの等価検索
ネクストキーロッ
クではないが
45. 複合インデックス順番
• a, b の複合インデックス
• b = x にインデックスは効かない
• a = x and c = x は、a のみのインデックスと同じ効果