Mysql中的同时算术函数

Mysql中的同时算术函数

问题描述:

I have a quick question I haven't been able to find an answer for in google searches. When performing addition and subtraction operations on a mysql table where I could have multiple users interacting with the database simultaneously, how does it handle those requests?

For example if I want to track how many email submissions have been completed using a php script to add 1 to a field like,

    "UPDATE $table SET emailSubmits = (emailSubmits + 1)"

and I've already had 10 submissions and I get 2 people who submit their email at the same time, and they both pull the value of that field at the same time (10), will both instances try to update the quantity to 11 or is mySQL smart enough to manage simultaneous submissions so that I still end up with a total of 12?...Also if it is capable of this, does the same hold true if I have the possibility of 1,000 or 10,000 submissions simultaneously?

我有一个简单的问题我无法在谷歌搜索中找到答案。 在mysql表上执行加法和减法操作时,我可以让多个用户同时与数据库交互,它如何处理这些请求? p>

例如,如果我想跟踪多少封电子邮件 提交已经完成,使用php脚本将1添加到字段,如 p>

 “UPDATE $ table SET emailSubmits =(emailSubmits + 1)”
  code>  
 
 

我已经有10个提交,我有2个人同时提交他们的电子邮件,他们同时提取该字段的值(10),将 两个实例都尝试将数量更新为11或mySQL是否足够聪明以管理同时提交,以便我最终总共有12个?...如果它能够做到这一点,如果我有这个,那么同样适用 同时提交1,000或10,000份提案的可能性? p> div>

Mysql or like other relational Database lock the current row where they make an operation. Mysql will push the other request in pool and after the first make is operation the second will does their.