我在这个答案中总结了我的评论。
In general, when an index is not being used, it's because using it won't help much. That is, it will not save much time compared with a full table scan (this tends to happen when the cardinality of the index is low). This seems to be the case here since you have about the same number of rows in the table than rows that you want to select. In this case, a full scan is usually cheaper than using the index.
Also, deleting is a "write" action. Indices optimize reads, at the cost of making writes more expensive (because of index rebuilding on writes). So the fact that you have some complex indices does not help, but aggravates the problem. An index makes sense when it narrows down the number of rows to retrieve; otherwise it offers no real gain and could even impose some extra overhead. Also, an index may, in the best case, make a SELECT more efficient. But it won't make writes (insert, update and delete) work faster; on the contrary, it will make them perform worse.
因此,您应该尝试摆脱并非绝对必要的索引。请记住,索引是一种权衡,它可能会使读取操作(选择)更快,但代价是使写入操作(插入、更新、删除)更慢。这是因为必须在写入后重建索引。
您可能想尝试一下:“如果您要从表中删除许多行,使用 DELETE QUICK 然后使用 OPTIMIZE TABLE 可能会更快。这会重建索引而不是执行许多索引块合并操作。” dev.mysql.com/doc/refman/5.0/en/delete.html
Yet another option (may work or not, just thinking out loud here): if you want to delete all but a few rows from visitss, perhaps you could insert the rows "WHERE month != '2013-10' into an auxiliary table, TRUNCATE visits, then insert back the rows from the aux table into visits and finally TRUNCATE the aux table. As you point out, though, you'll need to put up some sort of locking while this process is running.