Comment 2 for bug 1201443

Revision history for this message
Daniel Nichter (daniel-nichter) wrote : Re: pt-duplicate-key-checker raises error when explain shows key_len = 0

It's a MySQL bug or mystery why the first query in my previous comment returns key_len=0 but the second query returns key_len=4. If anything, the 2nd should (maybe) return zero because without "Using where" it's doing a full index scan, so it's not using any part of the parent_id index to match rows.

In any case, I fixed this in KeySize but checking for key=<key> && key_len=0. If this happen, get_key_size() calls itself again (only once) with a special arg that affects the EXPLAIN query in an attempt to get MySQL to actually use the index. It works in tests.