cockroachdb / cockroachdb/cockroach
sql/opt: substitute arguments directly during deferred routine body build
Open
A-sql-routine
C-enhancement
O-agent
T-sql-queries
- Dominant language
- Go
- Stars
- 32.5k
- Forks
- 4.1k
- PR merge metrics
- PR metrics pending
Description
Today each body statement is built **once** with parameter columns (partially normalized) and every invocation then does CopyAndReplace with the actual values + Optimize. Instead, we could substitute the actual argument values directly during the execution-time optbuild, which would:
- skip building and copying the intermediate parameter-column memo,
- let constants participate in normalization from the start,
- remove the delayed-normalization bookkeeping from the deferred path.
Related thread: https://cockroachlabs.slack.com/archives/G01R3EYPQKA/p1775847600668539
Epic CRDB-62565
Jira issue: CRDB-63458
Contributor guide
Assessment
This issue has not been assessed yet.