in reply to Re: Query rewriting question
in thread Query rewriting question
I wrote a reporting application that would join several million-row tables with complex WHERE clauses that returned back in, generally, under a second. Maybe your schema isn't designed with speed in mind?
Because you are doing a SELECT MIN() operation it is almost a guarantee that you cannot write this as a single query.
No. First, the inner query doesn't refer back to the outer query, so it's actually a constant that can be factored out. Second, every subquery can be rewritten as a join. Granted, you might have to do some funky HAVING and GROUP BY stuff, but it's possible.
|
|---|