Test for self join only when needed.