A self-join query with a BY clause generates a SQL query with an ORDER BY clause with the wrong index
A self-join query in combination with BY clause generates an SQL query with an ORDER BY clause on the unique_id_0 index instead of the unique, single field index that exists for the table.