84669 Lernen von Personen
152542 Lernen von Personen
20005 Lernen von Personen
5487 Lernen von Personen
7821 Lernen von Personen
359900 Lernen von Personen
3350 Lernen von Personen
180660 Lernen von Personen
48569 Lernen von Personen
18603 Lernen von Personen
40936 Lernen von Personen
1549 Lernen von Personen
1183 Lernen von Personen
32909 Lernen von Personen
类似评论的功能表table1内有字段floor,time,text如何实现floor自增,同时插入时加锁(防止高并发同floor),最好能有php代码
闭关修行中......
建表的时候说明floor是自增的就行了,比如create table table 1 (floor int not null auto_increment primary,time...)....如果表已经建好了用alter修改一下就行了。这样死活都重复不了的,和高并发无关。
创建数据库的时候不仅仅要把floor设为auto_increment,还必须把存储引擎设了innodb,innodb是行锁,并且写数据是分页的,myisam是表锁,是安partition写的。
建表的时候说明floor是自增的就行了,比如
create table table 1 (
floor int not null auto_increment primary,
time...
)....
如果表已经建好了用alter修改一下就行了。
这样死活都重复不了的,和高并发无关。
创建数据库的时候不仅仅要把floor设为auto_increment,还必须把存储引擎设了innodb,innodb是行锁,并且写数据是分页的,myisam是表锁,是安partition写的。