Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

opt/bench: fix benchmark regression #138740

Merged
merged 2 commits into from
Jan 14, 2025
Merged

Conversation

mgartner
Copy link
Collaborator

@mgartner mgartner commented Jan 9, 2025

opt/bench: fix benchmark regression

PR #138641 caused extra allocations for plan gist factories in optimizer
benchmarks. These allocations should not be included in benchmark
results, so they have been eliminated.

Release note: None

util/base64: use bytes.Buffer instead of strings.Builder in Encoder

For our purposes in base64-encoding plan gists, using bytes.Buffer in
Encoder causes fewer allocations, presumably because of a more
aggressive growth algorithm.

Epic: None

Release note: None

PR cockroachdb#138641 caused extra allocations for plan gist factories in optimizer
benchmarks. These allocations should not be included in benchmark
results, so they have been eliminated.

Release note: None
@mgartner mgartner requested a review from a team January 9, 2025 16:00
@mgartner mgartner requested a review from a team as a code owner January 9, 2025 16:00
@mgartner mgartner requested review from michae2 and removed request for a team January 9, 2025 16:00
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@mgartner
Copy link
Collaborator Author

mgartner commented Jan 9, 2025

name                                                old time/op    new time/op    delta
ExecBuild/kv-read                                      862ns ± 0%     576ns ± 1%  -33.20%  (p=0.000 n=9+10)
ExecBuild/kv-read-const                                862ns ± 0%     575ns ± 0%  -33.27%  (p=0.000 n=10+10)
ExecBuild/tpcc-new-order                              1.22µs ± 0%    0.95µs ± 0%  -22.19%  (p=0.000 n=9+10)
ExecBuild/tpcc-delivery                               1.05µs ± 1%    0.77µs ± 1%  -26.54%  (p=0.000 n=10+10)
ExecBuild/tpcc-stock-level                            2.46µs ± 0%    2.18µs ± 1%  -11.29%  (p=0.000 n=10+9)
ExecBuild/many-columns-and-indexes-a                  1.46µs ± 0%    1.17µs ± 0%  -19.78%  (p=0.000 n=10+10)
ExecBuild/many-columns-and-indexes-b                  1.88µs ± 0%    1.59µs ± 0%  -15.55%  (p=0.000 n=8+10)
ExecBuild/many-columns-and-indexes-c                  20.2µs ± 0%    19.7µs ± 1%   -2.45%  (p=0.000 n=10+10)
ExecBuild/many-columns-and-indexes-d                  14.9µs ± 1%    14.6µs ± 1%   -2.24%  (p=0.000 n=10+10)
ExecBuild/comp-pk                                     2.23µs ± 1%    1.94µs ± 0%  -12.73%  (p=0.000 n=10+7)
ExecBuild/comp-insert-on-conflict                     6.39µs ± 1%    5.99µs ± 1%   -6.21%  (p=0.000 n=10+10)
ExecBuild/single-col-histogram-range                  1.58µs ± 1%    1.33µs ± 0%  -15.73%  (p=0.000 n=10+10)
ExecBuild/single-col-histogram-bounded-range-small    1.64µs ± 1%    1.38µs ± 0%  -16.15%  (p=0.000 n=10+10)
ExecBuild/single-col-histogram-bounded-range-big      1.64µs ± 0%    1.38µs ± 0%  -15.77%  (p=0.000 n=10+10)
ExecBuild/json-insert                                  694ns ± 1%     441ns ± 0%  -36.47%  (p=0.000 n=10+10)
ExecBuild/json-comp-insert                             995ns ± 1%     724ns ± 0%  -27.20%  (p=0.000 n=10+10)
ExecBuild/batch-insert-one                            1.26µs ± 0%    0.99µs ± 0%  -21.37%  (p=0.000 n=10+9)
ExecBuild/batch-insert-many                           40.5µs ± 1%    40.6µs ± 2%     ~     (p=0.497 n=10+9)
ExecBuild/const-agg                                   4.72µs ± 0%    4.50µs ± 0%   -4.60%  (p=0.000 n=10+10)
ExecBuild/ored-preds-100                              42.6µs ± 1%    42.6µs ± 1%     ~     (p=0.739 n=10+10)
ExecBuild/ored-preds-using-params-100                 43.3µs ± 2%    42.6µs ± 1%   -1.56%  (p=0.000 n=10+10)
ExecBuild/slow-query-1                                10.6µs ± 0%    10.3µs ± 0%   -2.56%  (p=0.000 n=10+10)
ExecBuild/slow-query-2                                10.5µs ± 1%    10.0µs ± 0%   -4.68%  (p=0.000 n=10+8)
ExecBuild/slow-query-3                                14.1µs ± 4%    13.7µs ± 0%   -3.25%  (p=0.000 n=10+10)
ExecBuild/slow-query-4                                22.9µs ± 0%    22.7µs ± 1%   -0.83%  (p=0.000 n=10+10)
ExecBuild/slow-query-5                                1.86ms ± 2%    1.85ms ± 1%     ~     (p=0.631 n=10+10)
ExecBuild/slow-query-6                                 265µs ± 1%     262µs ± 1%   -1.01%  (p=0.000 n=10+9)
ExecBuild/slow-query-7                                 385µs ± 1%     385µs ± 1%     ~     (p=0.971 n=10+10)

name                                                old alloc/op   new alloc/op   delta
ExecBuild/kv-read                                     1.76kB ± 0%    0.61kB ± 0%  -65.45%  (p=0.000 n=10+10)
ExecBuild/kv-read-const                               1.76kB ± 0%    0.61kB ± 0%  -65.45%  (p=0.000 n=10+10)
ExecBuild/tpcc-new-order                              2.01kB ± 0%    0.86kB ± 0%  -57.37%  (p=0.000 n=10+10)
ExecBuild/tpcc-delivery                               1.78kB ± 0%    0.62kB ± 0%  -64.86%  (p=0.000 n=10+10)
ExecBuild/tpcc-stock-level                            2.80kB ± 0%    1.65kB ± 0%  -41.14%  (p=0.000 n=10+10)
ExecBuild/many-columns-and-indexes-a                  2.21kB ± 0%    1.06kB ± 0%  -52.17%  (p=0.000 n=10+10)
ExecBuild/many-columns-and-indexes-b                  2.50kB ± 0%    1.34kB ± 0%  -46.15%  (p=0.000 n=10+10)
ExecBuild/many-columns-and-indexes-c                  24.0kB ± 0%    22.8kB ± 0%   -4.80%  (p=0.000 n=10+10)
ExecBuild/many-columns-and-indexes-d                  12.0kB ± 0%    10.9kB ± 0%   -9.58%  (p=0.000 n=10+10)
ExecBuild/comp-pk                                     3.32kB ± 0%    2.17kB ± 0%  -34.70%  (p=0.000 n=10+10)
ExecBuild/comp-insert-on-conflict                     8.07kB ± 0%    6.92kB ± 0%  -14.27%  (p=0.000 n=10+10)
ExecBuild/single-col-histogram-range                  2.65kB ± 0%    1.50kB ± 0%  -43.50%  (p=0.000 n=10+10)
ExecBuild/single-col-histogram-bounded-range-small    2.65kB ± 0%    1.50kB ± 0%  -43.50%  (p=0.000 n=10+10)
ExecBuild/single-col-histogram-bounded-range-big      2.65kB ± 0%    1.50kB ± 0%  -43.50%  (p=0.000 n=10+10)
ExecBuild/json-insert                                 1.81kB ± 0%    0.66kB ± 0%  -63.72%  (p=0.000 n=10+10)
ExecBuild/json-comp-insert                            2.20kB ± 0%    1.05kB ± 0%  -52.36%  (p=0.000 n=10+10)
ExecBuild/batch-insert-one                            2.57kB ± 0%    1.42kB ± 0%  -44.86%  (p=0.000 n=10+10)
ExecBuild/batch-insert-many                           72.2kB ± 0%    71.1kB ± 0%   -1.60%  (p=0.000 n=10+10)
ExecBuild/const-agg                                   6.18kB ± 0%    5.02kB ± 0%  -18.65%  (p=0.000 n=10+10)
ExecBuild/ored-preds-100                              28.1kB ± 0%    27.0kB ± 0%   -4.10%  (p=0.000 n=10+10)
ExecBuild/ored-preds-using-params-100                 28.1kB ± 0%    27.0kB ± 0%   -4.10%  (p=0.000 n=10+10)
ExecBuild/slow-query-1                                12.1kB ± 0%    10.9kB ± 0%   -9.53%  (p=0.000 n=10+10)
ExecBuild/slow-query-2                                9.63kB ± 0%    8.48kB ± 0%  -11.96%  (p=0.000 n=10+10)
ExecBuild/slow-query-3                                17.3kB ± 0%    16.2kB ± 0%   -6.64%  (p=0.000 n=10+10)
ExecBuild/slow-query-4                                45.9kB ± 0%    44.8kB ± 0%   -2.51%  (p=0.000 n=10+10)
ExecBuild/slow-query-5                                2.78MB ± 0%    2.78MB ± 0%   -0.04%  (p=0.001 n=8+9)
ExecBuild/slow-query-6                                 357kB ± 0%     356kB ± 0%   -0.32%  (p=0.000 n=10+10)
ExecBuild/slow-query-7                                 519kB ± 0%     518kB ± 0%   -0.22%  (p=0.000 n=10+10)

name                                                old allocs/op  new allocs/op  delta
ExecBuild/kv-read                                       9.00 ± 0%      8.00 ± 0%  -11.11%  (p=0.000 n=10+10)
ExecBuild/kv-read-const                                 9.00 ± 0%      8.00 ± 0%  -11.11%  (p=0.000 n=10+10)
ExecBuild/tpcc-new-order                                12.0 ± 0%      11.0 ± 0%   -8.33%  (p=0.000 n=10+10)
ExecBuild/tpcc-delivery                                 11.0 ± 0%      10.0 ± 0%   -9.09%  (p=0.000 n=10+10)
ExecBuild/tpcc-stock-level                              23.0 ± 0%      22.0 ± 0%   -4.35%  (p=0.000 n=10+10)
ExecBuild/many-columns-and-indexes-a                    15.0 ± 0%      14.0 ± 0%   -6.67%  (p=0.000 n=10+10)
ExecBuild/many-columns-and-indexes-b                    19.0 ± 0%      18.0 ± 0%   -5.26%  (p=0.000 n=10+10)
ExecBuild/many-columns-and-indexes-c                    87.0 ± 0%      86.0 ± 0%   -1.15%  (p=0.000 n=10+10)
ExecBuild/many-columns-and-indexes-d                    38.0 ± 0%      37.0 ± 0%   -2.63%  (p=0.000 n=10+10)
ExecBuild/comp-pk                                       17.0 ± 0%      16.0 ± 0%   -5.88%  (p=0.000 n=10+10)
ExecBuild/comp-insert-on-conflict                       46.0 ± 0%      45.0 ± 0%   -2.17%  (p=0.000 n=10+10)
ExecBuild/single-col-histogram-range                    11.0 ± 0%      10.0 ± 0%   -9.09%  (p=0.000 n=10+10)
ExecBuild/single-col-histogram-bounded-range-small      11.0 ± 0%      10.0 ± 0%   -9.09%  (p=0.000 n=10+10)
ExecBuild/single-col-histogram-bounded-range-big        11.0 ± 0%      10.0 ± 0%   -9.09%  (p=0.000 n=10+10)
ExecBuild/json-insert                                   7.00 ± 0%      6.00 ± 0%  -14.29%  (p=0.000 n=10+10)
ExecBuild/json-comp-insert                              10.0 ± 0%       9.0 ± 0%  -10.00%  (p=0.000 n=10+10)
ExecBuild/batch-insert-one                              9.00 ± 0%      8.00 ± 0%  -11.11%  (p=0.000 n=10+10)
ExecBuild/batch-insert-many                             7.00 ± 0%      6.00 ± 0%  -14.29%  (p=0.000 n=10+10)
ExecBuild/const-agg                                     23.0 ± 0%      22.0 ± 0%   -4.35%  (p=0.000 n=10+10)
ExecBuild/ored-preds-100                                 410 ± 0%       409 ± 0%   -0.24%  (p=0.000 n=10+10)
ExecBuild/ored-preds-using-params-100                    410 ± 0%       409 ± 0%   -0.24%  (p=0.000 n=10+10)
ExecBuild/slow-query-1                                  74.0 ± 0%      73.0 ± 0%   -1.35%  (p=0.000 n=10+10)
ExecBuild/slow-query-2                                  77.0 ± 0%      76.0 ± 0%   -1.30%  (p=0.000 n=10+10)
ExecBuild/slow-query-3                                  37.0 ± 0%      36.0 ± 0%   -2.70%  (p=0.000 n=10+10)
ExecBuild/slow-query-4                                  28.0 ± 0%      27.0 ± 0%   -3.57%  (p=0.000 n=10+10)
ExecBuild/slow-query-5                                   649 ± 0%       648 ± 0%   -0.15%  (p=0.000 n=10+10)
ExecBuild/slow-query-6                                   299 ± 0%       298 ± 0%   -0.33%  (p=0.000 n=10+10)
ExecBuild/slow-query-7                                   362 ± 0%       361 ± 0%   -0.28%  (p=0.000 n=10+10)

Copy link
Member

@yuzefovich yuzefovich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewed 1 of 1 files at r1, all commit messages.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @michae2)

…der`

For our purposes in base64-encoding plan gists, using `bytes.Buffer` in
`Encoder` causes fewer allocations, presumably because of a more
aggressive growth algorithm.

Release note: None
@mgartner
Copy link
Collaborator Author

mgartner commented Jan 9, 2025

I added a second commit. Will post benchmark results of that commit shortly.

Copy link
Member

@yuzefovich yuzefovich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Reviewed 1 of 1 files at r2, all commit messages.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (and 1 stale) (waiting on @michae2)

@mgartner
Copy link
Collaborator Author

mgartner commented Jan 9, 2025

Diff between first and second commit:

name                                                old time/op    new time/op    delta
ExecBuild/kv-read                                      579ns ± 1%     599ns ± 0%   +3.57%  (p=0.008 n=5+5)
ExecBuild/kv-read-const                                577ns ± 0%     600ns ± 0%   +3.96%  (p=0.008 n=5+5)
ExecBuild/tpcc-new-order                               955ns ± 1%     937ns ± 1%   -1.84%  (p=0.032 n=4+5)
ExecBuild/tpcc-delivery                                779ns ± 0%     789ns ± 0%   +1.22%  (p=0.008 n=5+5)
ExecBuild/tpcc-stock-level                            2.24µs ± 0%    2.20µs ± 0%   -1.79%  (p=0.008 n=5+5)
ExecBuild/many-columns-and-indexes-a                  1.19µs ± 0%    1.17µs ± 0%   -2.17%  (p=0.008 n=5+5)
ExecBuild/many-columns-and-indexes-b                  1.60µs ± 0%    1.58µs ± 0%   -1.82%  (p=0.008 n=5+5)
ExecBuild/many-columns-and-indexes-c                  19.9µs ± 1%    19.9µs ± 1%     ~     (p=0.690 n=5+5)
ExecBuild/many-columns-and-indexes-d                  14.6µs ± 0%    14.7µs ± 0%   +0.73%  (p=0.008 n=5+5)
ExecBuild/comp-pk                                     1.94µs ± 0%    1.93µs ± 1%   -0.57%  (p=0.024 n=5+5)
ExecBuild/comp-insert-on-conflict                     5.98µs ± 1%    5.98µs ± 0%     ~     (p=0.841 n=5+5)
ExecBuild/single-col-histogram-range                  1.33µs ± 0%    1.36µs ± 0%   +1.84%  (p=0.008 n=5+5)
ExecBuild/single-col-histogram-bounded-range-small    1.39µs ± 1%    1.40µs ± 0%   +0.99%  (p=0.008 n=5+5)
ExecBuild/single-col-histogram-bounded-range-big      1.38µs ± 0%    1.40µs ± 0%   +1.16%  (p=0.008 n=5+5)
ExecBuild/json-insert                                  441ns ± 0%     451ns ± 0%   +2.25%  (p=0.008 n=5+5)
ExecBuild/json-comp-insert                             723ns ± 1%     728ns ± 0%   +0.65%  (p=0.024 n=5+5)
ExecBuild/batch-insert-one                             983ns ± 0%     987ns ± 0%     ~     (p=0.095 n=5+5)
ExecBuild/batch-insert-many                           40.0µs ± 0%    39.9µs ± 0%     ~     (p=0.286 n=4+5)
ExecBuild/const-agg                                   4.46µs ± 1%    4.45µs ± 0%     ~     (p=0.135 n=5+5)
ExecBuild/ored-preds-100                              42.9µs ± 1%    44.4µs ± 0%   +3.57%  (p=0.008 n=5+5)
ExecBuild/ored-preds-using-params-100                 42.8µs ± 1%    44.8µs ± 1%   +4.67%  (p=0.008 n=5+5)
ExecBuild/slow-query-1                                10.4µs ± 0%    10.4µs ± 0%     ~     (p=0.254 n=5+5)
ExecBuild/slow-query-2                                10.1µs ± 1%    10.1µs ± 1%     ~     (p=0.690 n=5+5)
ExecBuild/slow-query-3                                13.6µs ± 0%    13.5µs ± 0%   -1.22%  (p=0.008 n=5+5)
ExecBuild/slow-query-4                                22.6µs ± 0%    22.6µs ± 1%     ~     (p=0.548 n=5+5)
ExecBuild/slow-query-5                                1.85ms ± 1%    1.86ms ± 2%     ~     (p=0.841 n=5+5)
ExecBuild/slow-query-6                                 265µs ± 1%     264µs ± 0%     ~     (p=0.690 n=5+5)
ExecBuild/slow-query-7                                 381µs ± 2%     382µs ± 1%     ~     (p=0.421 n=5+5)

name                                                old alloc/op   new alloc/op   delta
ExecBuild/kv-read                                       608B ± 0%      648B ± 0%   +6.58%  (p=0.008 n=5+5)
ExecBuild/kv-read-const                                 608B ± 0%      648B ± 0%   +6.58%  (p=0.008 n=5+5)
ExecBuild/tpcc-new-order                                856B ± 0%      864B ± 0%   +0.93%  (p=0.008 n=5+5)
ExecBuild/tpcc-delivery                                 624B ± 0%      664B ± 0%   +6.41%  (p=0.008 n=5+5)
ExecBuild/tpcc-stock-level                            1.65kB ± 0%    1.66kB ± 0%   +0.49%  (p=0.008 n=5+5)
ExecBuild/many-columns-and-indexes-a                  1.06kB ± 0%    1.06kB ± 0%   +0.76%  (p=0.008 n=5+5)
ExecBuild/many-columns-and-indexes-b                  1.34kB ± 0%    1.35kB ± 0%   +0.60%  (p=0.008 n=5+5)
ExecBuild/many-columns-and-indexes-c                  22.8kB ± 0%    22.8kB ± 0%   -0.25%  (p=0.008 n=5+5)
ExecBuild/many-columns-and-indexes-d                  10.9kB ± 0%    10.8kB ± 0%   -0.52%  (p=0.008 n=5+5)
ExecBuild/comp-pk                                     2.17kB ± 0%    2.21kB ± 0%   +1.85%  (p=0.008 n=5+5)
ExecBuild/comp-insert-on-conflict                     6.92kB ± 0%    6.86kB ± 0%   -0.81%  (p=0.008 n=5+5)
ExecBuild/single-col-histogram-range                  1.50kB ± 0%    1.53kB ± 0%   +2.41%  (p=0.008 n=5+5)
ExecBuild/single-col-histogram-bounded-range-small    1.50kB ± 0%    1.53kB ± 0%   +2.41%  (p=0.008 n=5+5)
ExecBuild/single-col-histogram-bounded-range-big      1.50kB ± 0%    1.53kB ± 0%   +2.41%  (p=0.008 n=5+5)
ExecBuild/json-insert                                   656B ± 0%      712B ± 0%   +8.54%  (p=0.008 n=5+5)
ExecBuild/json-comp-insert                            1.05kB ± 0%    1.10kB ± 0%   +5.34%  (p=0.008 n=5+5)
ExecBuild/batch-insert-one                            1.42kB ± 0%    1.47kB ± 0%   +3.95%  (p=0.008 n=5+5)
ExecBuild/batch-insert-many                           71.1kB ± 0%    71.1kB ± 0%   +0.08%  (p=0.008 n=5+5)
ExecBuild/const-agg                                   5.02kB ± 0%    5.03kB ± 0%   +0.16%  (p=0.008 n=5+5)
ExecBuild/ored-preds-100                              27.0kB ± 0%    27.0kB ± 0%   +0.15%  (p=0.008 n=5+5)
ExecBuild/ored-preds-using-params-100                 27.0kB ± 0%    27.0kB ± 0%   +0.15%  (p=0.008 n=5+5)
ExecBuild/slow-query-1                                10.9kB ± 0%    10.9kB ± 0%   -0.51%  (p=0.008 n=5+5)
ExecBuild/slow-query-2                                8.48kB ± 0%    8.42kB ± 0%   -0.66%  (p=0.008 n=5+5)
ExecBuild/slow-query-3                                16.2kB ± 0%    16.1kB ± 0%   -0.35%  (p=0.008 n=5+5)
ExecBuild/slow-query-4                                44.8kB ± 0%    44.8kB ± 0%   +0.02%  (p=0.008 n=5+5)
ExecBuild/slow-query-5                                2.78MB ± 0%    2.78MB ± 0%   -0.05%  (p=0.029 n=4+4)
ExecBuild/slow-query-6                                 356kB ± 0%     356kB ± 0%   -0.02%  (p=0.008 n=5+5)
ExecBuild/slow-query-7                                 518kB ± 0%     518kB ± 0%   +0.01%  (p=0.008 n=5+5)

name                                                old allocs/op  new allocs/op  delta
ExecBuild/kv-read                                       8.00 ± 0%      7.00 ± 0%  -12.50%  (p=0.008 n=5+5)
ExecBuild/kv-read-const                                 8.00 ± 0%      7.00 ± 0%  -12.50%  (p=0.008 n=5+5)
ExecBuild/tpcc-new-order                                11.0 ± 0%       9.0 ± 0%  -18.18%  (p=0.008 n=5+5)
ExecBuild/tpcc-delivery                                 10.0 ± 0%       9.0 ± 0%  -10.00%  (p=0.008 n=5+5)
ExecBuild/tpcc-stock-level                              22.0 ± 0%      20.0 ± 0%   -9.09%  (p=0.008 n=5+5)
ExecBuild/many-columns-and-indexes-a                    14.0 ± 0%      12.0 ± 0%  -14.29%  (p=0.008 n=5+5)
ExecBuild/many-columns-and-indexes-b                    18.0 ± 0%      16.0 ± 0%  -11.11%  (p=0.008 n=5+5)
ExecBuild/many-columns-and-indexes-c                    86.0 ± 0%      83.0 ± 0%   -3.49%  (p=0.008 n=5+5)
ExecBuild/many-columns-and-indexes-d                    37.0 ± 0%      34.0 ± 0%   -8.11%  (p=0.008 n=5+5)
ExecBuild/comp-pk                                       16.0 ± 0%      15.0 ± 0%   -6.25%  (p=0.008 n=5+5)
ExecBuild/comp-insert-on-conflict                       45.0 ± 0%      42.0 ± 0%   -6.67%  (p=0.008 n=5+5)
ExecBuild/single-col-histogram-range                    10.0 ± 0%       9.0 ± 0%  -10.00%  (p=0.008 n=5+5)
ExecBuild/single-col-histogram-bounded-range-small      10.0 ± 0%       9.0 ± 0%  -10.00%  (p=0.008 n=5+5)
ExecBuild/single-col-histogram-bounded-range-big        10.0 ± 0%       9.0 ± 0%  -10.00%  (p=0.008 n=5+5)
ExecBuild/json-insert                                   6.00 ± 0%      6.00 ± 0%     ~     (all equal)
ExecBuild/json-comp-insert                              9.00 ± 0%      9.00 ± 0%     ~     (all equal)
ExecBuild/batch-insert-one                              8.00 ± 0%      8.00 ± 0%     ~     (all equal)
ExecBuild/batch-insert-many                             6.00 ± 0%      6.00 ± 0%     ~     (all equal)
ExecBuild/const-agg                                     22.0 ± 0%      20.0 ± 0%   -9.09%  (p=0.008 n=5+5)
ExecBuild/ored-preds-100                                 409 ± 0%       408 ± 0%   -0.24%  (p=0.008 n=5+5)
ExecBuild/ored-preds-using-params-100                    409 ± 0%       408 ± 0%   -0.24%  (p=0.008 n=5+5)
ExecBuild/slow-query-1                                  73.0 ± 0%      70.0 ± 0%   -4.11%  (p=0.008 n=5+5)
ExecBuild/slow-query-2                                  76.0 ± 0%      73.0 ± 0%   -3.95%  (p=0.008 n=5+5)
ExecBuild/slow-query-3                                  36.0 ± 0%      33.0 ± 0%   -8.33%  (p=0.008 n=5+5)
ExecBuild/slow-query-4                                  27.0 ± 0%      25.0 ± 0%   -7.41%  (p=0.008 n=5+5)
ExecBuild/slow-query-5                                   648 ± 0%       644 ± 0%   -0.62%  (p=0.008 n=5+5)
ExecBuild/slow-query-6                                   298 ± 0%       295 ± 0%   -1.01%  (p=0.008 n=5+5)
ExecBuild/slow-query-7                                   361 ± 0%       358 ± 0%   -0.83%  (p=0.008 n=5+5)

@mgartner
Copy link
Collaborator Author

TFTR!

bors r+

craig bot pushed a commit that referenced this pull request Jan 14, 2025
137805: sql/row: use Put instead of CPut when updating value of secondary index r=yuzefovich,stevendanna a=michae2

**sql/row: use Put instead of CPut when updating value of secondary index**

When an UPDATE statement changes the value but not the key of a secondary index (e.g. an update to the stored columns of a secondary index) we need to write a new version of the secondary index KV with the new value.

We were using a CPutAllowingIfNotExists to do this, which verified that if the KV existed, the expected value was the value before update. But there's no need for this verification. We have other mechanisms to detect a write-write conflict with any other transaction that could have changed the value concurrently. We can simply use a Put to overwrite the previous value.

This also matches what we do for the primary index when the PK doesn't change.

Epic: None

Release note: None

---

**sql: change CPutAllowingIfNotExists with nil expValue to CPut**

CPutAllowingIfNotExists with empty expValue is equivalent to CPut with empty expValue, so change a few spots to use regular CPut. This almost gets rid of CPutAllowingIfNotExists entirely, but there is at least one spot in backfill (introduced in #138707) that needs to allow for both a non-empty expValue and non-existence of the KV.

Also drop "(expecting does not exist)" from CPut tracing, as CPut with empty expValue is now overwhelmingly the most common use of CPut. And this matches the tracing in #138707.

Epic: None

Release note: None

138243: changefeedccl: fix PTS test r=stevendanna a=asg0451

Fix failing TestPTSRecordProtectsTargetsAndSystemTables test

Fixes: #135639
Fixes: #138066
Fixes: #137885
Fixes: #137505
Fixes: #136396
Fixes: #135805
Fixes: #135639

Release note: None

138696: sql: add CHECK EXTERNAL CONNECTION command r=kev-cao a=kev-cao

This patch adds the `CHECK EXTERNAL CONNECTION` command and replaces the old `SHOW BACKUP CONNECTION` syntax.

Epic: None

Release note: None

138740: opt/bench: fix benchmark regression r=mgartner a=mgartner

#### opt/bench: fix benchmark regression

PR #138641 caused extra allocations for plan gist factories in optimizer
benchmarks. These allocations should not be included in benchmark
results, so they have been eliminated.

Release note: None

#### util/base64: use `bytes.Buffer` instead of `strings.Builder` in `Encoder`

For our purposes in base64-encoding plan gists, using `bytes.Buffer` in
`Encoder` causes fewer allocations, presumably because of a more
aggressive growth algorithm.

Epic: None

Release note: None


138877: opt: reduce allocations when filtering histogram buckets r=mgartner a=mgartner

`cat.HistogramBuckets` are now returned and passed by value in
`getFilteredBucket` and `(*Histogram).addBucket`, respectively,
eliminating some heap allocations.

Also, two allocations when building spans from buckets via the
`spanBuilder` have been combined into one. The new `(*spanBuilder).init`
method simplifies the API by no longer requiring that prefix datums are
passed to every invocation of `makeSpanFromBucket`. This also reduces
redundant copying of the prefix.

Epic: None

Release note: None


139029: sql/logictest: disable column family mutations in some cases r=mgartner a=mgartner

Random column family mutations are now disabled for `CREATE TABLE`
statements with unique, hash-sharded indexes. This prevents the AST
from being reserialized with a `UNIQUE` constraint with invalid options,
instead of the original `UNIQUE INDEX`. See #65929 and #107398.

Epic: None

Release note: None


139039: ccl/serverccl: revise `TestTenantVars` cpu time checks r=xinhaoz a=xinhaoz

Previously, this test verified that a portion of the test's user cpu time would be less than or equal to the entire tenant user cpu time up to that point. This check is flaky because there's no guarantee that the inactive tenant's cpu time will surpass the test cpu time. We now simply verify that the test cpu times are greater than or equal to the tenant metrics.

The test was likely  passing before 331596c because the reported tenant cpu time was accounting for the sql server prestart. A tenant's user cpu metrics are tracked from the time the `_status/load` endpoint is registered, and the commit above moved the router setup to occur just after the prestart.

Epic: none
Fixes: #119329

Release note: None

Co-authored-by: Michael Erickson <[email protected]>
Co-authored-by: Miles Frankel <[email protected]>
Co-authored-by: Kevin Cao <[email protected]>
Co-authored-by: Marcus Gartner <[email protected]>
Co-authored-by: Xin Hao Zhang <[email protected]>
@craig
Copy link
Contributor

craig bot commented Jan 14, 2025

Build failed (retrying...):

  • unit_tests

@mgartner
Copy link
Collaborator Author

bors r+

@craig craig bot merged commit fb98afe into cockroachdb:master Jan 14, 2025
22 checks passed
@mgartner mgartner deleted the fix-opt-bench branch January 15, 2025 13:21
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.

3 participants