I did a test on a table (with innodb and myisam), which use PHP to simulate 2 set of update开发者_StackOverflow社区, as follow
set 1. // execute 1000 times for ($i = 0; $i < 1000; $i++) { update with pdo }
set 2. // execute 1 time { update with pdo }
normally, each update take ~0.001x sec with myisam and ~0.03x sec with innodb, so not surprise for set 1 use 1000 more times then set 2, however, during testing set 1, I open set 2 at another browser windows, what I expect is the result will return within the total time of set 1, but it seems it wait for set 1 finish, rather then insert into the queue during set 1 running.
Am I did something wrong or my concept is wrong? And is the update time slow?(my pc config is AMD Athlon 64 4200+, 2G RAM, Windows 7, MySQL 5.5.9, nginx 0.8.5, PHP 5.3.5)
thanks a lot~!
For MyISAM tables, concurrent inserts are an issue. See
http://dev.mysql.com/doc/refman/5.1/en/concurrent-inserts.html
If you are inserting to an InnoDB table with an auto_increment column, there's a discussion of locking issues here:
http://dev.mysql.com/doc/refman/5.1/en/innodb-auto-increment-handling.html
精彩评论