Originally asked in https://answers.launchpad.net/maria/+question/252779
In a query like:
No index is used since b.c3 is a column of a left join table, so the optimizer ignores it.
We have implemented an optimization in our client code that split the query in two: first part with WHERE b.c3 IS NULL, and a second part with WHERE b.c3 IS NOT NULL (depending on the order by ascending clause). It works great and most of the times the second part is not needed (when using limit). But it would be great if the database engine can figure it out by itself.