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