LEFT JOIN Significantly faster than INNER JOIN
问题 I have a table ( MainTable ) with a bit over 600,000 records. It joins onto itself via a 2nd table ( JoinTable ) in a parent/child type relationship: SELECT Child.ID, Parent.ID FROM MainTable AS Child JOIN JoinTable ON Child.ID = JoinTable.ID JOIN MainTable AS Parent ON Parent.ID = JoinTable.ParentID AND Parent.SomeOtherData = Child.SomeOtherData I know that every child record has a parent record and the data in JoinTable is acurate. When I run this query it takes literally minutes to run.