Look at the second query. It has "Distinct". I think this wrong. "Distinct"
doesn't work with "Using join buffer".

To make sure we are on the same page: "Distinct" in table B means that as soon
as we've got a match for current record in table A, we don't have to look for
any other matches. The query's SELECT list is "SELECT DISTINCT A.a", there is
no point to look for additional A.row-B.row pairs with the same A.row.