Mysql触发器/事件vs Cronjob [英] Mysql trigger/events vs Cronjob

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

问题描述

我有一个拍卖网站,让我的用户放置无限量的自动出价。

I have an auction website which let my users place an unlimited amount of autobiddings.

要监视这些自动投标,有些东西必须每秒检查一次数据库。

To monitor these autobiddings something has to check the database every second.

我的问题是如果最好使用mysql触发器事件,或者每分钟执行一个60秒的循环php脚本用户cronjob。

My question is if it is better to use mysql trigger events or to user a cronjob every minute that executes a 60 sec looping php script.

如果我使用mysql触发器事件,会有数百个事件堆栈在eachother,并在不同的时间发射。这是可能吗? ANd不是服务器负载调配是非常重要的。我听说某个地方的数据库将被锁定,而有一个schedueled事件。我使用的是innoDB表btw。

If i use the mysql trigger events there will be hundreds of events stacks on eachother, and fired on different times. Is this even possible?? ANd isn't the server load goning to be enourmous. I heard somewhere that the database will be locked while there is a schedueled event. I am using innoDB tables btw.

我希望有人可以在这个主题上留下一些光。

I hope some one can shed some light on this toppic.

推荐答案

您最好运行一个独立运行的脚本,并监视您的数据库。这样你不需要cron。也不是大量的触发器。

You'd best run a seperate script that runs eternally and watches your database. That way you won't need cron. Nor a massive amount of triggers.

但你可能想重新考虑你的整个问题。没有必要每秒更新出价。您只需要填写过去的x分钟/小时,有人实际将他的浏览器指向竞价或手动出价。如果是所有autobids,你可以轻松计算向前转发。

But you might want to reconsider your entire question. It's not necessary to actually update the bids every second. You only need to fill in the past x minutes/hours when someone actually points his browser to an auction or makes a manual bid. If it's all autobids you can calculate forwards an backwards with ease.

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

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