in reply to Speed blues
There's not much to go on here, the codes certainly no worse than my own.
How do you know the database is not the choke point? (they usually are :-). I don't know MySql (its the only major DB I've never used) But Count(*) and Order by often entail table scanning and temp tables. How is your database set up, are all your most active tables on the same disk? Is this not a concurrency issue? A query in isolation can run fine but when 200 people are trying to do the same thing at the same time...
Dunno give up.
400,000 records growing all the time are you sure this isn't a porn site ;-)
"We are all prompted by the same motives, all deceived by the same fallacies, all animated by hope, obstructed by danger, entangled by desire, and seduced by pleasure."
- Samuel Johnson