ID 越过---没有生成 id 为64的记录 请问为什么
tsung测试 ejabberd http插入 数据库接口
+------------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+------------+--------------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| vname | varchar(128) | YES | UNI | NULL | |
+------------+--------------+------+-----+---------+----------------+
select * from names where id like'6_' order by id;
+----------+------------+
| id | vname |
+----------+------------+
| 60 | test160 |
| 61 | test161 |
| 62 | test162 |
| 63 | test163 |
| 65 | test164 |
| 66 | test165 |
| 67 | test166 |
| 68 | test167 |
| 69 | test168 |
+----------+------------+
这个与数据库内部实现机制有关。这个自增的字段属于临界资源,肯定是受内部并发控制锁来进行控制的。 再加上一定的缓存机制,可能前一个操作会预先分配了65和66,后一个操作只得到67,然后前一个操作只用了65,那么66就没有人再用力。
oracle里面这个情况很常见。
是的。
它可能预分配资源,为了保持效率