Adaptive Server processes a query in these steps:
The query is parsed and normalized. The parser ensures that the SQL syntax is correct. Normalization ensures that all the objects referenced in the query exist. Permissions are checked to ensure that the user has permission to access all tables and columns in the query.
Preprocessing changes some search arguments to an optimized form and adds optimized search arguments and join clauses.
As the query is optimized, each part of the query is analyzed, and the best query plan is chosen. Optimization includes:
Each table is analyzed.
The cost of using each index that matches a search argument or join column is estimated.
The join order and join type are chosen.
The final access method is determined.
The chosen query plan is compiled.
The query is executed, and the results are returned to the user.