MySQL insert with autoincrement - is insert ignore neccessary to avoid concurrency issue? -
i using simple insert statement in mysql innodb, auto-increment in primary id. need worry if user , user b execute same script @ same moment, user a's insertion overwritten user b's?
no, not. can treat thread safe.
from reference:
when accessing auto-increment counter, innodb uses special table-level auto-inc lock keeps end of current sql statement, not end of transaction
http://dev.mysql.com/doc/refman/5.1/en/innodb-auto-increment-handling.html
Comments
Post a Comment