Cronjob或MySQL事件? [英] Cronjob or MySQL event?

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

问题描述

我必须每小时更新我的​​MySQL数据库,我想知道使用cronjob VS一个MySQL事件的优点/缺点?例如,哪个更快?哪个更安全?谢谢!

I have to update my MySQL database every hour, and I was wondering what the advantages/disadvantages of using a cronjob VS a MySQL event? For example, which is faster? Which is safer? Thanks!

推荐答案

我总是去一个cron工作,因为:

I would always go a cron job, because:


  • 这是sysadmins期望的地方(这一点不被低估)

  • crobtab是防弹,经过时间测试,

  • 某些数据库任务需要/偏好mysql是离线的(
  • 例如完全备份),所以你必须使用cron的 - 这是一个坏主意,有一些任务用cron和一些用mysql完成;
  • That's where sysadmins will expect it to be (this point is not to be underestimated)
  • crobtab is bullet-proof, time-tested, extremely widely used and understood
  • You can freely direct/analyse error/success messages where you want
  • Some database tasks require/prefer mysql to be off-line (eg full backup), so you've got to use cron for those - it's a bad idea to have some tasks done with cron and some done with mysql; you'll be unsure where to look
  • You can chain up other events that should follow if you've got a shell script

最后,只是因为你可以做某事,并不意味着它是一个好主意。 Mysql是好的数据东西。不要使用它shell的东西。

And finally, just because you can do something, doesn't mean it's a good idea. Mysql is good at data stuff. Don't use it for "shell" stuff.

这篇关于Cronjob或MySQL事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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