Figure 11-1 shows the basic compilation “pipeline” for a single query.
Figure 11-1. Query processor pipeline.
When a query is compiled, the SQL statement is first parsed into an equivalent tree representation. For queries with valid SQL syntax, the next stage performs a series of validation steps on the query, generally called binding, where the columns and tables in the tree are compared to database metadata to ensure that those columns and tables exist and are visible to the current user. This stage also performs semantic checks on the query to ensure that it’s valid, such as making sure that the columns bound to a GROUP BY operation are ...