Home | Previous Page | Next Page   Appendix B. How SQL Queries Are Executed > Parallel Query Execution >

Access Plan

The way that the optimizer chooses to read a table is called an access plan. The simplest way to access a table is to read it sequentially, which is called a table scan. The optimizer chooses a table scan when most of the table must be read or when the table does not have an index that is useful for the query.

The optimizer can also choose to access the table by an index. If the indexed column is the same as a column in a filter of the query, the optimizer can use the index to retrieve only the rows that the query requires. If all of the required columns are in one or more indexes on the table, the optimizer can use a key-only index scan. The database server retrieves data from the index but does not access the associated table.

The optimizer compares the costs of each plan to determine the best one. The database server calculates costs from estimates of the number of I/O operations required, calculations required to produce the results, rows accessed, sorting, and so on.

Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]