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

Popular posts from this blog

c++ - Function signature as a function template parameter -

algorithm - What are some ways to combine a number of (potentially incompatible) sorted sub-sets of a total set into a (partial) ordering of the total set? -

How to call a javascript function after the page loads with a chrome extension? -