Question: what are the stages in query optimization?
Answer: Steps for Query Optimization Query optimization involves three steps, namely query tree generation, plan generation, and query plan code generation. A query tree is a tree data structure representing a relational algebra expression. The tables of the query are represented as leaf nodes.