cockroachdb / cockroachdb/cockroach
opt: hoist an uncorrelated subquery multiple times
Open
C-enhancement
T-sql-queries
- Dominant language
- Go
- Stars
- 32.5k
- Forks
- 4.1k
- PR merge metrics
- PR metrics pending
Description
In #115142, we limited the optimizer from hoisting an instance of an uncorrelated subquery more than once. This was done to prevent the possibility of producing expressions with child expressions that produce the same column IDs (see #114703). A downside of this limitation is that it could prevent the optimizer from producing an optimal query plan in some cases.
It may be possible to lift this restriction by generating new columns IDs for the subquery's sub-expression each time it is hoisted.
Jira issue: CRDB-33984
Contributor guide
Assessment
This issue has not been assessed yet.