Query optimization and plan selection

This chapter focuses on the basic elements of query optimization, query execution plan analysis, and selection. It discusses how the query time can be estimated using the tools where the input/output (I/O) time can be estimated from the sequential and random block accesses needed to execute a query. It also focuses on the estimation of intermediate table size in a query made up of a series of selections, projections, and joins. Table size is a critical measure of how long merge joins take, whereas index definitions help determine how long indexed or hash joins take to execute. The basic steps of query processing are scanning, parsing, and decomposition of Structured Query Language (SQL) query; query optimization; and query code and execution.