Skip to content

prototype: sql: reuse insertFastPathNodes#160735

Draft
mgartner wants to merge 5 commits intocockroachdb:masterfrom
mgartner:cache-insert-fast-path-node
Draft

prototype: sql: reuse insertFastPathNodes#160735
mgartner wants to merge 5 commits intocockroachdb:masterfrom
mgartner:cache-insert-fast-path-node

Conversation

@mgartner
Copy link
Copy Markdown
Contributor

@mgartner mgartner commented Jan 8, 2026

sql/tests: add sysbench oltp_delete_insert_only benchmark

Release note: None

sql: add Reuse and Destroy methods to planNode interface

The Reuse and Destroy methods have been added to the planNode
interface. All implementations of Reuse are currently no-ops that
return ok=false. All implementations of Destroy are currently
no-ops. In the future these methods will allow planNode trees to be
cached and reused for multiple executions. See the inline comments for
more details.

Release note: None

opt: track stats timestamps in execbuilder instead of durations

Execbuilder now tracks the timestamps of stats collections and forecasts
instead of the duration between the current time and those timestamps.
This decouples execbuild-time from execution-time and will allow for
accurate instrumentation of time-since-stats-collection and
time-since-stats-forecast when planNodes are cached in the future—in
which case execbuild will only happen once for the query, not for every
execution.

Release note: None

opt: refactor execbuilder metrics

Metrics collected at execbuild-time are now encapsulated in
exec.Metrics and applied to an instrumentationHelper with the
RecordExecMetrics method. This is a mechanical change with no change
in behavior. Unit tests have also been added for exec.Metrics and
exec.IndexesUsed.

Release note: None

sql: reuse insertFastPathNodes

Release note: None

The `Reuse` and `Destroy` methods have been added to the `planNode`
interface. All implementations of `Reuse` are currently no-ops that
return `ok=false`. All implementations of `Destroy` are currently
no-ops. In the future these methods will allow `planNode` trees to be
cached and reused for multiple executions. See the inline comments for
more details.

Release note: None
Execbuilder now tracks the timestamps of stats collections and forecasts
instead of the duration between the current time and those timestamps.
This decouples execbuild-time from execution-time and will allow for
accurate instrumentation of time-since-stats-collection and
time-since-stats-forecast when `planNode`s are cached in the future—in
which case execbuild will only happen once for the query, not for every
execution.

Release note: None
Metrics collected at execbuild-time are now encapsulated in
`exec.Metrics` and applied to an `instrumentationHelper` with the
`RecordExecMetrics` method. This is a mechanical change with no change
in behavior. Unit tests have also been added for `exec.Metrics` and
`exec.IndexesUsed`.

Release note: None
@mgartner mgartner requested a review from a team January 8, 2026 23:32
@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

@mgartner
Copy link
Copy Markdown
Contributor Author

mgartner commented Jan 8, 2026

name                                              old time/op    new time/op    delta
Sysbench/SQL/1node_local/oltp_delete_insert_only     725µs ± 1%     719µs ± 1%  -0.85%  (p=0.000 n=15+15)

name                                              old errs/op    new errs/op    delta
Sysbench/SQL/1node_local/oltp_delete_insert_only      0.00           0.00         ~     (all equal)

name                                              old alloc/op   new alloc/op   delta
Sysbench/SQL/1node_local/oltp_delete_insert_only     134kB ± 1%     131kB ± 0%  -2.17%  (p=0.000 n=15+15)

name                                              old allocs/op  new allocs/op  delta
Sysbench/SQL/1node_local/oltp_delete_insert_only       775 ± 0%       750 ± 0%  -3.23%  (p=0.000 n=15+15)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants