MySQL过程线程安全吗? [英] Is a MySQL procedure thread safe?

查看:557
本文介绍了MySQL过程线程安全吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一些需要与数据库交互的网站.我不会在这里举一个复杂的例子.我的问题实际上归结为:MySQL过程线程安全吗?如果我网站上的一个客户端触发了一个过程,我可以认为它是原子的,还是会干扰其他用户的另一个请求?

I am developing some websites that need to interact with a database. I will not bring here a complicated example. My question actually comes down to: Is a MySQL procedure thread safe? If one client on my site triggers a procedure, can I assume it is atomic, or could it interfere with another request from another user?

推荐答案

取决于您是否正在使用SQL事务.在没有适当使用事务和实际序列化级别的情况下,过程可能会在写调用中公开某些数据,例如,在整个过程完成之前,其他查询/过程可以看到这些数据.

Depends on if you're using SQL transactions. Its possible, without the appropriate use of transactions and the actual serialization level, that a procedure can expose some data in a write call, for instance, that is visible to other queries / procedures before the complete procedure has completed.

简而言之:只有在使用适当的事务级别时,给定的过程才是原子的

in short: a given procedure will only be atomic if you use the appropriate transaction level

这篇关于MySQL过程线程安全吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆