4 ms·
Dell Software's Toad Query Optimizer (for Oracle and SQL Server) has an engine that does exactly that. It takes your SQL, tries rewriting it a bunch of differen
by BrentOzar 10y ago
Dell Software's Toad Query Optimizer (for Oracle and SQL Server) has an engine that does exactly that. It takes your SQL, tries rewriting it a bunch of different ways, throws in different compiler hints, and measures the response time/reads/CPU/etc for each execution, then gives you a set of graphs and recommendations.
I wanna say it was around $1500/seat last time I looked at it. It's worth every penny if you have to write a lot of complex queries. I've bought it for just one senior member of a dev team, and everybody brings their worst queries to that person for tuning.
Here's the trick, though: after it optimizes a query for you, keep your original query around. You're not going to want to try to edit the query that Toad produces - it can be horrifically complex. Instead, edit your original query, then run it through Toad again.