1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
drop table if exists t1;
Warnings:
Note 1051 Unknown table 't1'
create table t1 (id int, index (id)) engine = pbxt;
insert into t1 values (1), (2), (3), (4), (5);
begin;
select * from t1 where id < 5 for update;
id
1
2
3
4
update t1 set id = 8 where id = 5;
update t1 set id = 8 where id = 4;
show processlist;
Id User Host db Command Time State Info
x root x test Query x NULL show processlist
x root x test Query x Searching rows for update update t1 set id = 8 where id = 4
commit;
select * from t1;
id
1
2
3
8
8
drop table if exists t1;
create table t1 (id int) engine = pbxt;
insert into t1 values (1), (2), (3), (4), (5);
begin;
select * from t1 where id > 10 for update;
id
update t1 set id = 8;
commit;
select * from t1;
id
8
8
8
8
8
drop table if exists t1;
create table t1 (id int, index (id)) engine = pbxt;
insert into t1 values (1), (2), (3), (4), (5);
begin;
select * from t1 where id = 5 for update;
id
5
update t1 set id = 8 where id < 4;
update t1 set id = 8 where id = 5;
show processlist;
Id User Host db Command Time State Info
x root x test Query x NULL show processlist
x root x test Query x Searching rows for update update t1 set id = 8 where id = 5
commit;
select * from t1;
id
4
8
8
8
8
drop table if exists t1;
create table t1 (id int, index (id)) engine = pbxt;
insert into t1 values (1), (2), (3), (4), (5);
select * from t1 for update;
id
1
2
3
4
5
update t1 set id = 8;
drop table if exists t1;
create table t1 (id int, index (id)) engine = pbxt;
insert into t1 values (1), (2), (3), (4), (5);
create procedure p1 ()
begin
select * from t1 for update;
end|
call p1 ();
id
1
2
3
4
5
update t1 set id = 8;