时间:2012-04-01 18:50:08 作者: 来源:
点击:
:SET GLOBAL tx_isolation=’REPEATABLE-READ’ID | 事务1 | 事务1输出 | 事务2 | 事务2输出 |
1 | START TRANSACTION; | | | |
2 | select max(ID) FROM account; | 124999 | | |
3 | | | START TRANSACTION; | |
4 | UPDATE account set gmt_create=date_add(gmt_create,interval +1 day) WHERE ID >=124999; | | | |
5 | | | insert into account(VACCOUNT_ID,gmt_create) values(‘eugene’,now()); | STATE:update |
6 | | | 事务2超时 | |
7 | | | START TRANSACTION; | |
8 | | | SELECT * FROM account WHERE ID =124998; | 2007-10-20 13:47 |
9 | | | UPDATE account set gmt_create=date_add(gmt_create,interval +1 day) WHERE ID =124998; | 执行成功 |
10 | | | SELECT * FROM account WHERE ID =124998; | 2007-10-21 13:47 |
11 | COMMIT; | | | |
12 | | | COMMIT; | |
| | | | |
1 | START TRANSACTION; | | | |
2 | UPDATE account set gmt_create=date_add(gmt_create,interval -1 day) WHERE gmt_create >’2009-07-01′; | | | |
3 | | | START TRANSACTION; | |
4 | | | SELECT * FROM account WHERE gmt_create>’2009-07-10′ LIMIT 1; | 2009-10-2 13:47 |
5 | SELECT * FROM account WHERE gmt_create>’2009-07-10′ LIMIT 1; | 2009-10-1 13:47 | | STATE:update |
6 | | | insert into account(VACCOUNT_ID,gmt_create) values(‘gmt_create_test’,now()); | |
7 | | | 事务2超时 | |
8 | COMMIT; | | | |
9 | | | SELECT * FROM account WHERE gmt_create>’2009-07-10′ LIMIT 1; | 2009-10-1 13:47 |
无索引条件更新事务 |
1 | START TRANSACTION; | | | |
| UPDATE account set gmt_create=date_add(gmt_create,interval -1 day) WHERE gmt_create >’2009-07-01′ AND gmt_create <’2009-07-10′; | | | |
| | | START TRANSACTION; | |
| | | insert into account(VACCOUNT_ID,gmt_create) values(‘gmt_create_interval’,now()); | |
| | | 事务2超时 | |
| COMMIT; | | | |