基于封技术、基于时戳技术、基于有效性检查、MVCC 等技术是并发控制技术
代码语言:javascript复制mysql> create table z (
-> a int not null,
-> b int null,
-> c int not null,
-> d int not null,
-> unique key (b),
-> unique key (d),
-> unique key (c));
Query OK, 0 rows affected (0.09 sec)
mysql> insert into z select 1,2,3,4;
Query OK, 1 row affected (0.01 sec)
Records: 1 Duplicates: 0 Warnings: 0
mysql> insert into z select 5,6,7,8;
Query OK, 1 row affected (0.01 sec)
Records: 1 Duplicates: 0 Warnings: 0
mysql> insert into z select 9,10,11,12;
Query OK, 1 row affected (0.01 sec)
Records: 1 Duplicates: 0 Warnings: 0
mysql> select a,b,c,d,_rowid from z;
--- ------ ---- ---- --------
| a | b | c | d | _rowid |
--- ------ ---- ---- --------
| 1 | 2 | 3 | 4 | 4 |
| 5 | 6 | 7 | 8 | 8 |
| 9 | 10 | 11 | 12 | 12 |
--- ------ ---- ---- --------
3 rows in set (0.02 sec)
d列先定义,所以d被先定义为主键
代码语言:javascript复制mysql> create table a(
-> a int,
-> b int,
-> primary key(a,b)
-> )engine=InnoDB;
Query OK, 0 rows affected (0.04 sec)
mysql> insert into a select 1,1
-> ;
Query OK, 1 row affected (0.00 sec)
Records: 1 Duplicates: 0 Warnings: 0
mysql> select a,_rowid from a;
ERROR 1054 (42S22): Unknown column '_rowid' in 'field list'
mysql>
如果是多个列定义到主键,则_rowid无法获取主键