-
Notifications
You must be signed in to change notification settings - Fork 4.1k
sql: use the same determination for optimizations during prepare as exec #26958
Copy link
Copy link
Closed
Labels
A-sql-optimizerSQL logical planning and optimizations.SQL logical planning and optimizations.C-bugCode not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.
Description
Logical plans in CockroachDB are created on 3 different paths:
- the regular "simply query" execution path in
(connExecutor) dispatchToExecutionEngine() - PREPARE statements in SQL and pgwire prepare messages, via
(connExecutor) prepare() - DO NOTHING mutations (parallel statements)
The optimizer cluster setting currently only works with the 1st code path.
Arguably we are not supporting the 3rd because the optimizer doesn't deal with mutations yet.
However the 2nd is a problem since most applications use prepared queries: queries using correlation appear currently broken with the prepare protocol despite the setting "optimizer is enabled".
The solution is to factor the choice of planning engine across (connExecutor) dispatchToExecutionEngine() and (connExecutor) prepare().
cc @justinj
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A-sql-optimizerSQL logical planning and optimizations.SQL logical planning and optimizations.C-bugCode not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.