MySQL INSERT and SELECT Order of precedence

Posted by Carlos Dubus on Stack Overflow See other posts from Stack Overflow or by Carlos Dubus
Published on 2010-05-15T23:11:16Z Indexed on 2010/05/15 23:20 UTC
Read the original article Hit count: 197

Filed under:
|

Hi, if an INSERT and a SELECT are done simultaneously on a mysql table which one will go first?

Example: Suppose "users" table row count is 0.

Then this two queries are run at the same time (assume it's at the same mili/micro second):

INSERT into users (id) values (1)

and

SELECT COUNT(*) from users

Will the last query return 0 or 1?

© Stack Overflow or respective owner

Related posts about mysql

Related posts about precedence