There appears to be a bug in the database module in Moodle.
This is only apparent if you upgrade from Moodle 1.8 to Moodle 1.9, like we did.
When a user searches the database the CPU on the server hits 100% and hangs. The only way to restore activity is to restart the MySQL and Apache processes.
I discovered that it was the pagination of results that was causing the problem and as a temporary fix I changed the select statement to select * rather than select count(*).
I no longer have pagination but results are returned within a seconds as opposed to 10 minutes which was happening with the bug.
The bug has been reported in the Moodle Tracker.