doubiao7410 2017-02-19 18:12
浏览 37
已采纳

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?

  • 写回答

1条回答 默认 最新

  • dongyin5516 2017-02-19 18:18
    关注

    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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 stata安慰剂检验作图但是真实值不出现在图上
  • ¥15 c程序不知道为什么得不到结果
  • ¥40 复杂的限制性的商函数处理
  • ¥15 程序不包含适用于入口点的静态Main方法
  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题