Guides to understanding and tuning the query planning process.
SELECT
queries are declarativeâthey donât prescribe the exact sequence of operations that the database will execute in order to answer them.
It is the job of the query planner to figure out this sequence in the form of an execution plan.
Query planning in Firebolt consists of a logical and a physical optimization phase.
Both phases follow a modular design by instantiating a set of rules and an optimization driver.
The driver instance receives an input query plan and transforms it by running through a sequence of pre-configured transformation passes.
Each rewrite pass contains a set of rewrite rules that are executed during the traversal of the query plan.
The rewrite pass keeps traversing the plan until the query plan reaches a fixed point, ie. when a full traversal ends without performing any modification to the query plan.
Rules are generally split into several categories:
GROUPING SETS
aggregations.Filter
operators sitting on top of each other).EXPLAIN
command in order to inspect query plans at various stages of the query lifecycle.