Chapter 29. Optimization of Statements

Introduction

In Chapter 20, “Using Indexes,” we showed that the presence of an index can improve the execution time of certain statements. The question remains, though, whether the optimizer can always develop the best processing strategy for all statements. Unfortunately, the answer is that it cannot. Some statements are written in such a way that the optimizer is in no position to develop the fastest processing strategy. This occurs principally when WHERE clause conditions are too complex or when the optimizer is taken along a “false trail.” In addition, even when indexes are available, the optimizer sometimes chooses a sequential processing strategy for those statements.

Practice has shown that a certain ...

Get Introduction to SQL: Mastering the Relational Database Language, Fourth Edition/20th Anniversary Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.