Comment 9 for bug 978432

Revision history for this message
Daniel Nichter (daniel-nichter) wrote :

I realized a simpler, better solution. The very original issue for this bug was http://code.google.com/p/maatkit/issues/detail?id=378

MySQL's chosen index is only something we should prefer if --where is used. Else, we can chose our own index and disregard the MySQL index from EXPLAIN SELECT * FROM tbl WHERE 1=1 (the row estimate) because this query is nothing like the checksum queries. If there's a --where, however, then it's used instead of 1=1 and then the MySQL is important because it tells us how MySQL plans to optimize for the --where.

The latest code of the branch simply does:

   if ( !$where ) {
      $mysql_index = undef;
   }

The test for this bug passes and all original tests pass too.