CHAPTER 11Query Optimization

The query tree class shown in Chapter 10 forms the starting point for building the experimental query optimization and execution engine for DBXP. In this chapter, I'll show you how to add the optimizer to the query tree class. I'll begin by explaining the rationale for the heuristics (or rules) used in the optimizer, and then jump into writing the code. Because the code for some of the functions is quite lengthy, the code examples shown in this chapter are excerpts. If you are following along by coding the examples, I recommend you download the source code for this chapter instead of typing in the code from scratch.

Types of Query Optimizers

The first query optimizers were designed for use in early database systems ...

Get Expert MySQL now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.