Here is the script I said I would upload. Needs to be saved in the top level of your Moodle site, then run form the command line. To simulate a lot of load, we ran it multiple times simultaneously from several computers. The script needs to be edited to work with your Moodle site.
This is great. Our site got hammered again today, so we will be looking into where the issue is.
I just want to add that I don't know exactly why my Moodle site gradually slowed and finally crashed, or why optimizing the SQL database helped.
Perhaps Moodle's SQL database tables get fragmented, like a hard disk drive gets fragmented?
Maybe one of the experts can comment.
In the meantime, Hostmonster's tech support people pointed me to this article on the subject.
http://www.codeproject.com/Articles/34372/Top-steps-to-optimize-data-access-in-SQL-Server
---Peter