简体   繁体   English

mariadb/mysql 事件实际上是如何工作的,如果每 1 天都安排一次? ENDS 有什么用? 它会完全禁用事件吗?

[英]How mariadb/mysql events works actually, in case of ON SCHEDULE EVERY 1 DAY ? and What is the use of ENDS? Does it completely disable event?

  CREATE EVENT test_event5
  ON SCHEDULE EVERY 1 DAY  
  STARTS  TIMESTAMP(CURRENT_DATE)+ INTERVAL 1 DAY 
  ENDS  TIMESTAMP(CURRENT_DATE)+ INTERVAL 1 DAY+ INTERVAL 1 HOUR
  ON COMPLETION PRESERVE ENABLE
  DO  --Any query here--

I have written this event but it I have a little confusion on STARTS date?我已经写了这个活动,但是我对开始日期有点困惑? What will be next STARTS and ENDS date after executing this.执行此操作后,下一个 STARTS 和 ENDS 日期将是什么。 Suppose today is 2022-Jan-05, as per my code its STARTS and ENDS date will be 2022-Jan-06 which is next day.假设今天是 2022 年 1 月 5 日,根据我的代码,它的开始和结束日期将是 2022 年 1 月 6 日,即第二天。 What will be the start date at 2022-Jan-06? 2022 年 1 月 6 日的开始日期是什么时候? Will it be change to 2022-Jan-07?会改为 2022-Jan-07 吗?

As per my understanding STARTS date be 2022-Jan-07 in the next day.据我了解,STARTS 日期是第二天的 2022-Jan-07。 What is the use of ENDS? ENDS有什么用?

Need expert opinion.需要专家意见。 Thanks in advance.提前致谢。

STARTS defines when the event will begin to be active and ENDS defines when the event ceases to execute. STARTS定义事件何时开始激活, ENDS定义事件何时停止执行。 Both do not move or change, they are static values .两者都不会移动或改变,它们是 static 值

Your event will never execute outside this defined time window.您的事件将永远不会在此定义的时间 window 之外执行。

You define a time window during which your event is able to execute in intervals defined in ON SCHEDULE EVERY , given that ON COMPLETION PRESERVE is defined otherwise it will only execute once and then dropped.您定义了一个时间 window ,在此期间您的事件能够在ON SCHEDULE EVERY中定义的间隔内执行,前提是定义了ON COMPLETION PRESERVE ,否则它将只执行一次然后丢弃。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM