Optimizing SQL
There is no set of rules for writing code that will take the best advantage of every query optimizer on every SQL product every time. The query optimizers depend on the underlying architecture and are simply too different for many universal rules; however, we can make a few general statements. Just remember that you have to test code. What would improve performance in one SQL implementation might not do anything at all in another or make the performance worse. Even worse, the next release of the same SQL can perform differently.
There are two kinds of optimizers: cost-based and rule-based. A rule-based optimizer (such as Oracle before Version 7.0) will parse a query and execute it in the order in which it was written, perhaps ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access