Optimizing LEFT JOIN

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

Optimizing LEFT JOIN

Post by anjanesh »

My SQL query containing a LEFT JOIN is taking over 2 mins to finish.
I have id as PRIMARY, col2 as UNIQUE and col3 as INDEX - still i takes so much time - I added col3 as INDEX just to see if the time taken is less for the LEFT JOIN query but isnt.

Any other way to optimize the query ?

Thanks
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

use EXPLAIN to help you determine how fields are being used.
Post Reply