Why architecture matters here

Planners fail on stale stats, missing indexes, and join order surprises. Architecture matters because stats + rewriter + cost model must all be current.

Advertisement

The architecture: every piece explained

The top strip is the pipeline. SQL. Parser + AST. Logical plan. Rewriter.

The middle row is cost + physical. Cost model. Physical plan. Join order. Adaptive execution.

The lower rows are ops. Explain + hints. Plan cache. Ops — stats maintenance + alerts.

DB query planner — parser + logical rewrite + cost + physical + adaptivethe brain that turns SQL into a planSQLuser queryParser + ASTsyntaxLogical planoperator treeRewriterrules + predicate pushCost modelcardinality + statsPhysical planoperators + indexesJoin ordersearch + heuristicsAdaptive executionruntime replanningExplain + hintsdeveloper surfacePlan cacheprepared statementsOps — stats maintenance + regression alertsestimatematerializesearchadaptexplaincachecacheoperateoperate
Query planner from SQL to physical plan.
Advertisement

End-to-end flow

End-to-end: SQL parsed. Rewriter pushes predicates below joins. Cost model picks join order. Physical plan uses indexes. Adaptive detects skew mid-query and re-plans. Explain output helps developer verify.