Django: How can you stop long queries from killing your database?
You shouldn't write queries like that, at least not to run against your live database.  Mysql has a "slow queries" pararameter which you can use to identify the queries that are killing you.   Most of the time, these slow queries are either buggy or can be speeded up by defining a new index or two.
I'm using Django 1.1 with Mysql 5.* and MyISAM tables.
Some of my queries can take a TON of time for outliers in my data set. These lock the tables and shut the site down. Other times it seems some users cancel the request before it is done and some queries will be stuck in the "Preparing" phase locking all other queries out.
I'm going to try to track down all the corner cases, but its nice to have a safety net so the site doesn't come down.
How do I avoid this? Can I set maximum query times?