I want to compare two columns. They must be equal or they both must be null.
(t1.id is null and t2.id is null) or (t1.id = t2.id)
They are both indexed but MySQL does not use this index probably due to null values. Is there a way to do this where we can benefit from the indexes?