SQL Join Optimization
When a query is submitted, the Query Processor parses and verifies the query (see SQL Parsing and Verification). If the query passes the parsing and verification checks, the Query Processor begins the optimization process.
During the optimization process, the Query Processor performs calculations on every possible permutation for accessing the information required for your query. It then chooses the permutation that places the least demand on system resources. This means that your query is executed as efficiently as possible.
The optimization process is called the SQL Join Optimization phase, and to perform it, the Query Processor uses the SQL Join Optimization Algorithm.
The SQL Join Optimization Algorithm consists of four stages:
- Build the Sub-Clause List
- Determine the Sub-Clause Types
- Calculate the Table Order Permutations
- Calculate the Cost and Determine the Final Access Plan.
In each of the above sections, SQL terms are used frequently. If you are unfamiliar with SQL terminology or need extra information about a term, please refer to SQL Terminology.