PHP / MySQL database connection priority?

I have a database that uses usage statistics. This database is responsible for many other things (and not just statistical calculations). I use php to periodically collapse various permissions (day, week, month, year) of interesting statistics in buckets dictated by permission.

The php application that I wrote "completes" its data when it starts, so that it will calculate all the collapsed statistics for permissions and periods since the last launch. This is useful if we want to disable this function in order to debug database performance problems, because I can enable it and complete its data set regardless of the frequency of the script run (the cron job can be moved from daily to weekly, etc.).

The problem that I have is that the calculations are quite intense and result in the QPS of the production database server. Is there a way to set “priority” on a particular database connection in order to use these “shutdowns” to perform these calculations?

Perhaps the correct answer would be to replicate the tables in which I work to another statistics database, but, unfortunately, I do not have the resources to try such a thing (for now).

Thanks in advance for any help, Josh

+6
php mysql statistics
source share
1 answer

low_priority_updates should do exactly what you need.

+5
source share

All Articles