One Weird Trick for a 15,000x Improvement in PostgreSQL Performance
news.rapgenius.com
news.rapgenius.com
TL,DR:
Using the wrong indices results in really poor performance, especially if you sort then filter.
A classic screw-up along similar lines is "SELECT quote FROM quotes ORDER BY RAND() LIMIT 1"