如何以及何时在MySQL中正确使用SLEEP()? [英] How and when to use SLEEP() correctly in MySQL?

查看:898
本文介绍了如何以及何时在MySQL中正确使用SLEEP()?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

关于我的其他问题今天我想知道如何使用 MySQL的 正确.

In relation to my other question today I am wondering how to use MySQL's SLEEP(duration) correctly.

从我收集的阅读MySQL Dev论坛和MySQL文档中非常模糊的描述的内容来看,我不能以这种方式使用它:

From what I gathered reading MySQL Dev forums and very vague description in MySQL Docs I can't use it this way:

SELECT ...
SLEEP(1); /* wait for a second before another SELECT */
SELECT ...

那有什么好处呢?

推荐答案

SELECT ...
SELECT SLEEP(5);
SELECT ...

但是您将其用于什么?您是否要规避/重新设计互斥锁或事务?

But what are you using this for? Are you trying to circumvent/reinvent mutexes or transactions?

这篇关于如何以及何时在MySQL中正确使用SLEEP()?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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