Entry
How can I serialize resource intensive queries?
Feb 8th, 2000 07:49
Nathan Wallace, Sasha Pachev, Jason
Identifying resource-intensive queries, and establishing a locking
protocol (easily implemented with get_lock()/release_lock() ) to ensure
that only one of them gets executed at a time is a very good idea. I've
done this myself before, and would strongly recommend to give it a try
if you are experiencing performance problems due to some trouble
queries.
For example, imagine getting about 20 million queries a day, a mix of
updates, fast selects and slower selects. We require the slower selects
to obtain an application lock so only 1 can be executed at once - this
keeps the server up! Otherwise nearly 500 updates/fast selects a second
pile up and cause problems.