One of the basic nightmares of a web developer is optimizing queries. Every now and then, I keep seeing articles which advise lesser queries per web page, normalised tables, indexes on the most queried columns and a diligent logic.

Ofcourse, this is what is needed. But at the same time, not everyone is exposed to better optimization techniques. If you are one of those, who have written a perfect SQL but still wondering why it takes that longer for it to get executed, read on.