Here's an interesting trick to optimize a query. It involves manually breaking up the query into two parts and forcing the part that winnows down the results be executed first returning a small result, and then executing a potentially slow query on the resulting small set.