mysql

MySQL not use indexes for subqueries used in IN clause

One of clients mentioned awful slow query from Drupal's Boost module:

DELETE FROM boost_crawler WHERE hash IN (
  SELECT ca.hash_url FROM boost_cache ca
  WHERE ca.expire BETWEEN 1 AND 434966399 OR ca.expire > 434966400
)

Running EXPLAIN query turns out MySQL ignores indexes for boost_crawler.hash column completely. And I am not alone: