开发者

PHP/MySQL database connection priority?

开发者 https://www.devze.com 2022-12-24 00:12 出处:网络
I have a production database where usage statistics reside. This database is responsible for many other things (not just statistics calcs). I use php to periodically roll up different resolutions (day

I have a production database where usage statistics reside. This database is responsible for many other things (not just statistics calcs). I use php to periodically roll up different resolutions (day, week, month, year) of interesting statistics in buckets dictated by the resolution.

The php application I've written "completes" its data when its run, such that it will calculate all the rolled-up statistics for the resolutions and periods since it was last run. This is useful if we want to turn this off to debug database performance issues, because I can turn it back on and have it complete its data set independent of the script run frequency (cron job could be moved from daily to weekly, etc).

The problem I have, is the calculations are fairly intensive and drive the QPS of the production database server up. Is there a way to set a "priority" on a particular database connection so that it will only use "off-cycles" to do these calculations?

Maybe a proper response would be to repli开发者_如何学Gocate the tables I'm working on into a different stats database, but, unfortunately I don't have the resources in place to attempt such a thing (yet).

Thanks in advance for any help, Josh


low_priority_updates should do exactly what you need.

0

精彩评论

暂无评论...
验证码 换一张
取 消