作者:广东蒗缦m莎 | 来源:互联网 | 2023-05-17 21:57
IhaveastoredprocedureIdliketorunforever,butsleepforonesecondinaloop.Whenitwakes
I have a stored procedure I'd like to run forever, but sleep for one second in a loop. When it wakes up it would poll a table to see if it should do some work. Work only needs to be done every minute, so there is no worry about the poll table getting hit with updates from two writers at the same time.
我有一个存储过程,我想永远运行,但在一个循环中睡一秒钟。当它醒来时,它将轮询一个表,看它是否应该做一些工作。工作只需要每分钟完成,因此不必担心轮询表会同时受到来自两个编写者的更新的影响。
What is the best way to SLEEP()
for an interval in a stored procedure? It would be nice, actually, if it could sleep for 200 milliseconds, but one second would work too.
SLEEP()在存储过程中的间隔的最佳方法是什么?实际上,如果它可以睡眠200毫秒,那将是很好的,但是一秒也可以工作。
4 个解决方案