Skip to content

sql: disable buffered writes for implicit txns by default#164885

Open
yuzefovich wants to merge 1 commit intocockroachdb:masterfrom
yuzefovich:bw-implicit
Open

sql: disable buffered writes for implicit txns by default#164885
yuzefovich wants to merge 1 commit intocockroachdb:masterfrom
yuzefovich:bw-implicit

Conversation

@yuzefovich
Copy link
Member

@yuzefovich yuzefovich commented Mar 5, 2026

We expect that vast majority of implicit serializable txns don't benefit from the buffered writes feature while we've seen some regressions around blind writes, so this commit disables the buffered writes for all implicit txns. As an escape hatch, a new session variable buffered_writes_implicit_txns_enabled is introduced which can be set to true to get the previous behavior (to increase test coverage the default value for the session variable is metamorphically randomized in test builds).

One notable case is worth calling out. In the PG wire protocol, entering the extended protocol starts an implicit transaction which is then upgraded to explicit if BEGIN is executed as a prepared statement. See 9fdb39b for more context.

Fixes: #154553.
Release note: None

@trunk-io
Copy link
Contributor

trunk-io bot commented Mar 5, 2026

Merging to master in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

@cockroach-teamcity
Copy link
Member

This change is Reviewable

@yuzefovich yuzefovich marked this pull request as ready for review March 5, 2026 02:14
@yuzefovich yuzefovich requested a review from a team as a code owner March 5, 2026 02:14
@cockroach-teamcity
Copy link
Member

🔴 Sysbench [SQL, 3node, oltp_read_write]
Metric Old Commit New Commit Delta Note
🔴 sec/op 10.20m ±1% 11.04m ±1% +8.19% p=0.000 n=15
🔴 allocs/op 8.118k ±0% 9.442k ±1% +16.31% p=0.000 n=15
Reproduce

benchdiff binaries:

mkdir -p benchdiff/f87e0ff/bin/1058449141
gcloud storage cp gs://cockroach-microbench-ci/builds/f87e0ff60f1f86284babc4b2ca63bbfe5a2ee6d6/bin/pkg_sql_tests benchdiff/f87e0ff/bin/1058449141/cockroachdb_cockroach_pkg_sql_tests
chmod +x benchdiff/f87e0ff/bin/1058449141/cockroachdb_cockroach_pkg_sql_tests
mkdir -p benchdiff/5bf7a3c/bin/1058449141
gcloud storage cp gs://cockroach-microbench-ci/builds/5bf7a3c99c92d1c5ed83c404df21301795fd6341/bin/pkg_sql_tests benchdiff/5bf7a3c/bin/1058449141/cockroachdb_cockroach_pkg_sql_tests
chmod +x benchdiff/5bf7a3c/bin/1058449141/cockroachdb_cockroach_pkg_sql_tests

benchdiff command:

# NB: for best (most stable) results, also add a suitable `--benchtime` that
# results in ~1s to ~5s of benchmark runs. For example, if ops average ~3ms, a
# benchtime of `1000x` is appropriate.
#
# Some benchmarks (in particular BenchmarkSysbench) output additional memory
# profiles covering only the execution (excluding the setup/teardown) - those
# should be preferred for analysis since they more closely correspond to what's
# reported as B/op and alloc/op.
benchdiff --run=^BenchmarkSysbench/SQL/3node/oltp_read_write$ --old=5bf7a3c --new=f87e0ff --memprofile ./pkg/sql/tests
⚪ Sysbench [KV, 3node, oltp_read_only]
Metric Old Commit New Commit Delta Note
sec/op 3.153m ±2% 3.145m ±1% ~ p=0.967 n=15
allocs/op 2.105k ±0% 2.105k ±0% ~ p=0.904 n=15
Reproduce

benchdiff binaries:

mkdir -p benchdiff/f87e0ff/bin/1058449141
gcloud storage cp gs://cockroach-microbench-ci/builds/f87e0ff60f1f86284babc4b2ca63bbfe5a2ee6d6/bin/pkg_sql_tests benchdiff/f87e0ff/bin/1058449141/cockroachdb_cockroach_pkg_sql_tests
chmod +x benchdiff/f87e0ff/bin/1058449141/cockroachdb_cockroach_pkg_sql_tests
mkdir -p benchdiff/5bf7a3c/bin/1058449141
gcloud storage cp gs://cockroach-microbench-ci/builds/5bf7a3c99c92d1c5ed83c404df21301795fd6341/bin/pkg_sql_tests benchdiff/5bf7a3c/bin/1058449141/cockroachdb_cockroach_pkg_sql_tests
chmod +x benchdiff/5bf7a3c/bin/1058449141/cockroachdb_cockroach_pkg_sql_tests

benchdiff command:

# NB: for best (most stable) results, also add a suitable `--benchtime` that
# results in ~1s to ~5s of benchmark runs. For example, if ops average ~3ms, a
# benchtime of `1000x` is appropriate.
#
# Some benchmarks (in particular BenchmarkSysbench) output additional memory
# profiles covering only the execution (excluding the setup/teardown) - those
# should be preferred for analysis since they more closely correspond to what's
# reported as B/op and alloc/op.
benchdiff --run=^BenchmarkSysbench/KV/3node/oltp_read_only$ --old=5bf7a3c --new=f87e0ff --memprofile ./pkg/sql/tests
⚪ Sysbench [KV, 3node, oltp_write_only]
Metric Old Commit New Commit Delta Note
sec/op 2.879m ±1% 2.853m ±1% ~ p=0.098 n=15
allocs/op 4.213k ±0% 4.210k ±0% ~ p=0.405 n=15
Reproduce

benchdiff binaries:

mkdir -p benchdiff/f87e0ff/bin/1058449141
gcloud storage cp gs://cockroach-microbench-ci/builds/f87e0ff60f1f86284babc4b2ca63bbfe5a2ee6d6/bin/pkg_sql_tests benchdiff/f87e0ff/bin/1058449141/cockroachdb_cockroach_pkg_sql_tests
chmod +x benchdiff/f87e0ff/bin/1058449141/cockroachdb_cockroach_pkg_sql_tests
mkdir -p benchdiff/5bf7a3c/bin/1058449141
gcloud storage cp gs://cockroach-microbench-ci/builds/5bf7a3c99c92d1c5ed83c404df21301795fd6341/bin/pkg_sql_tests benchdiff/5bf7a3c/bin/1058449141/cockroachdb_cockroach_pkg_sql_tests
chmod +x benchdiff/5bf7a3c/bin/1058449141/cockroachdb_cockroach_pkg_sql_tests

benchdiff command:

# NB: for best (most stable) results, also add a suitable `--benchtime` that
# results in ~1s to ~5s of benchmark runs. For example, if ops average ~3ms, a
# benchtime of `1000x` is appropriate.
#
# Some benchmarks (in particular BenchmarkSysbench) output additional memory
# profiles covering only the execution (excluding the setup/teardown) - those
# should be preferred for analysis since they more closely correspond to what's
# reported as B/op and alloc/op.
benchdiff --run=^BenchmarkSysbench/KV/3node/oltp_write_only$ --old=5bf7a3c --new=f87e0ff --memprofile ./pkg/sql/tests
Artifacts

download:

mkdir -p new
gcloud storage cp gs://cockroach-microbench-ci/artifacts/f87e0ff60f1f86284babc4b2ca63bbfe5a2ee6d6/22699013640-1/\* new/
mkdir -p old
gcloud storage cp gs://cockroach-microbench-ci/artifacts/5bf7a3c99c92d1c5ed83c404df21301795fd6341/22699013640-1/\* old/

built with commit: f87e0ff60f1f86284babc4b2ca63bbfe5a2ee6d6

@cockroach-teamcity cockroach-teamcity added the X-perf-check Microbenchmarks CI: Added to a PR if a performance regression is detected and should be checked label Mar 5, 2026
@yuzefovich yuzefovich marked this pull request as draft March 5, 2026 03:09
@yuzefovich
Copy link
Member Author

Hold off on reviewing - looks like I did something wrong.

@yuzefovich yuzefovich marked this pull request as ready for review March 14, 2026 20:18
@yuzefovich
Copy link
Member Author

This is RFAL. The regression on sysbench was due to the special case I initially missed (that I mentioned in the commit message) where we might start an implicit txn for it to be upgraded soon after - this is now fixed by re-enabling buffered writes on the txn upgrade.

@cockroach-teamcity
Copy link
Member

⚪ Sysbench [SQL, 3node, oltp_read_write]
Metric Old Commit New Commit Delta Note
sec/op 11.45m ±2% 11.54m ±2% ~ p=0.713 n=15
allocs/op 8.132k ±3% 8.157k ±1% ~ p=0.660 n=15
Reproduce

benchdiff binaries:

mkdir -p benchdiff/92e4bfd/bin/1058449141
gcloud storage cp gs://cockroach-microbench-ci/builds/92e4bfdfe303a19e88974b50832a0404870aa3c6/bin/pkg_sql_tests benchdiff/92e4bfd/bin/1058449141/cockroachdb_cockroach_pkg_sql_tests
chmod +x benchdiff/92e4bfd/bin/1058449141/cockroachdb_cockroach_pkg_sql_tests
mkdir -p benchdiff/d423221/bin/1058449141
gcloud storage cp gs://cockroach-microbench-ci/builds/d4232215214da4de11ec1ba71c88cd26a1f26573/bin/pkg_sql_tests benchdiff/d423221/bin/1058449141/cockroachdb_cockroach_pkg_sql_tests
chmod +x benchdiff/d423221/bin/1058449141/cockroachdb_cockroach_pkg_sql_tests

benchdiff command:

# NB: for best (most stable) results, also add a suitable `--benchtime` that
# results in ~1s to ~5s of benchmark runs. For example, if ops average ~3ms, a
# benchtime of `1000x` is appropriate.
#
# Some benchmarks (in particular BenchmarkSysbench) output additional memory
# profiles covering only the execution (excluding the setup/teardown) - those
# should be preferred for analysis since they more closely correspond to what's
# reported as B/op and alloc/op.
benchdiff --run=^BenchmarkSysbench/SQL/3node/oltp_read_write$ --old=d423221 --new=92e4bfd --memprofile ./pkg/sql/tests
⚪ Sysbench [KV, 3node, oltp_read_only]
Metric Old Commit New Commit Delta Note
sec/op 3.039m ±1% 3.044m ±0% ~ p=0.106 n=15
allocs/op 2.105k ±0% 2.105k ±0% ~ p=0.641 n=15
Reproduce

benchdiff binaries:

mkdir -p benchdiff/92e4bfd/bin/1058449141
gcloud storage cp gs://cockroach-microbench-ci/builds/92e4bfdfe303a19e88974b50832a0404870aa3c6/bin/pkg_sql_tests benchdiff/92e4bfd/bin/1058449141/cockroachdb_cockroach_pkg_sql_tests
chmod +x benchdiff/92e4bfd/bin/1058449141/cockroachdb_cockroach_pkg_sql_tests
mkdir -p benchdiff/d423221/bin/1058449141
gcloud storage cp gs://cockroach-microbench-ci/builds/d4232215214da4de11ec1ba71c88cd26a1f26573/bin/pkg_sql_tests benchdiff/d423221/bin/1058449141/cockroachdb_cockroach_pkg_sql_tests
chmod +x benchdiff/d423221/bin/1058449141/cockroachdb_cockroach_pkg_sql_tests

benchdiff command:

# NB: for best (most stable) results, also add a suitable `--benchtime` that
# results in ~1s to ~5s of benchmark runs. For example, if ops average ~3ms, a
# benchtime of `1000x` is appropriate.
#
# Some benchmarks (in particular BenchmarkSysbench) output additional memory
# profiles covering only the execution (excluding the setup/teardown) - those
# should be preferred for analysis since they more closely correspond to what's
# reported as B/op and alloc/op.
benchdiff --run=^BenchmarkSysbench/KV/3node/oltp_read_only$ --old=d423221 --new=92e4bfd --memprofile ./pkg/sql/tests
⚪ Sysbench [KV, 3node, oltp_write_only]
Metric Old Commit New Commit Delta Note
sec/op 2.885m ±0% 2.895m ±1% ~ p=0.233 n=15
allocs/op 4.204k ±0% 4.205k ±0% ~ p=0.283 n=15
Reproduce

benchdiff binaries:

mkdir -p benchdiff/92e4bfd/bin/1058449141
gcloud storage cp gs://cockroach-microbench-ci/builds/92e4bfdfe303a19e88974b50832a0404870aa3c6/bin/pkg_sql_tests benchdiff/92e4bfd/bin/1058449141/cockroachdb_cockroach_pkg_sql_tests
chmod +x benchdiff/92e4bfd/bin/1058449141/cockroachdb_cockroach_pkg_sql_tests
mkdir -p benchdiff/d423221/bin/1058449141
gcloud storage cp gs://cockroach-microbench-ci/builds/d4232215214da4de11ec1ba71c88cd26a1f26573/bin/pkg_sql_tests benchdiff/d423221/bin/1058449141/cockroachdb_cockroach_pkg_sql_tests
chmod +x benchdiff/d423221/bin/1058449141/cockroachdb_cockroach_pkg_sql_tests

benchdiff command:

# NB: for best (most stable) results, also add a suitable `--benchtime` that
# results in ~1s to ~5s of benchmark runs. For example, if ops average ~3ms, a
# benchtime of `1000x` is appropriate.
#
# Some benchmarks (in particular BenchmarkSysbench) output additional memory
# profiles covering only the execution (excluding the setup/teardown) - those
# should be preferred for analysis since they more closely correspond to what's
# reported as B/op and alloc/op.
benchdiff --run=^BenchmarkSysbench/KV/3node/oltp_write_only$ --old=d423221 --new=92e4bfd --memprofile ./pkg/sql/tests
Artifacts

download:

mkdir -p new
gcloud storage cp gs://cockroach-microbench-ci/artifacts/92e4bfdfe303a19e88974b50832a0404870aa3c6/23095406184-1/\* new/
mkdir -p old
gcloud storage cp gs://cockroach-microbench-ci/artifacts/d4232215214da4de11ec1ba71c88cd26a1f26573/23095406184-1/\* old/

built with commit: 92e4bfdfe303a19e88974b50832a0404870aa3c6

@yuzefovich
Copy link
Member Author

Spoke too soon - there are some CI failures that I need to figure out.

@yuzefovich yuzefovich marked this pull request as draft March 14, 2026 21:05
@cockroach-teamcity
Copy link
Member

⚪ Sysbench [SQL, 3node, oltp_read_write]
Metric Old Commit New Commit Delta Note
sec/op 10.34m ±1% 10.25m ±2% ~ p=0.202 n=15
allocs/op 8.100k ±1% 8.113k ±0% ~ p=0.959 n=15
Reproduce

benchdiff binaries:

mkdir -p benchdiff/8764856/bin/1058449141
gcloud storage cp gs://cockroach-microbench-ci/builds/8764856ac514c540d1925e2269fa207327ffbbe4/bin/pkg_sql_tests benchdiff/8764856/bin/1058449141/cockroachdb_cockroach_pkg_sql_tests
chmod +x benchdiff/8764856/bin/1058449141/cockroachdb_cockroach_pkg_sql_tests
mkdir -p benchdiff/d423221/bin/1058449141
gcloud storage cp gs://cockroach-microbench-ci/builds/d4232215214da4de11ec1ba71c88cd26a1f26573/bin/pkg_sql_tests benchdiff/d423221/bin/1058449141/cockroachdb_cockroach_pkg_sql_tests
chmod +x benchdiff/d423221/bin/1058449141/cockroachdb_cockroach_pkg_sql_tests

benchdiff command:

# NB: for best (most stable) results, also add a suitable `--benchtime` that
# results in ~1s to ~5s of benchmark runs. For example, if ops average ~3ms, a
# benchtime of `1000x` is appropriate.
#
# Some benchmarks (in particular BenchmarkSysbench) output additional memory
# profiles covering only the execution (excluding the setup/teardown) - those
# should be preferred for analysis since they more closely correspond to what's
# reported as B/op and alloc/op.
benchdiff --run=^BenchmarkSysbench/SQL/3node/oltp_read_write$ --old=d423221 --new=8764856 --memprofile ./pkg/sql/tests
⚪ Sysbench [KV, 3node, oltp_read_only]
Metric Old Commit New Commit Delta Note
sec/op 3.164m ±1% 3.177m ±1% ~ p=0.436 n=15
allocs/op 2.107k ±0% 2.107k ±0% ~ p=0.712 n=15
Reproduce

benchdiff binaries:

mkdir -p benchdiff/8764856/bin/1058449141
gcloud storage cp gs://cockroach-microbench-ci/builds/8764856ac514c540d1925e2269fa207327ffbbe4/bin/pkg_sql_tests benchdiff/8764856/bin/1058449141/cockroachdb_cockroach_pkg_sql_tests
chmod +x benchdiff/8764856/bin/1058449141/cockroachdb_cockroach_pkg_sql_tests
mkdir -p benchdiff/d423221/bin/1058449141
gcloud storage cp gs://cockroach-microbench-ci/builds/d4232215214da4de11ec1ba71c88cd26a1f26573/bin/pkg_sql_tests benchdiff/d423221/bin/1058449141/cockroachdb_cockroach_pkg_sql_tests
chmod +x benchdiff/d423221/bin/1058449141/cockroachdb_cockroach_pkg_sql_tests

benchdiff command:

# NB: for best (most stable) results, also add a suitable `--benchtime` that
# results in ~1s to ~5s of benchmark runs. For example, if ops average ~3ms, a
# benchtime of `1000x` is appropriate.
#
# Some benchmarks (in particular BenchmarkSysbench) output additional memory
# profiles covering only the execution (excluding the setup/teardown) - those
# should be preferred for analysis since they more closely correspond to what's
# reported as B/op and alloc/op.
benchdiff --run=^BenchmarkSysbench/KV/3node/oltp_read_only$ --old=d423221 --new=8764856 --memprofile ./pkg/sql/tests
⚪ Sysbench [KV, 3node, oltp_write_only]
Metric Old Commit New Commit Delta Note
sec/op 3.035m ±2% 3.090m ±2% ~ p=0.217 n=15
allocs/op 4.219k ±0% 4.222k ±0% ~ p=0.156 n=15
Reproduce

benchdiff binaries:

mkdir -p benchdiff/8764856/bin/1058449141
gcloud storage cp gs://cockroach-microbench-ci/builds/8764856ac514c540d1925e2269fa207327ffbbe4/bin/pkg_sql_tests benchdiff/8764856/bin/1058449141/cockroachdb_cockroach_pkg_sql_tests
chmod +x benchdiff/8764856/bin/1058449141/cockroachdb_cockroach_pkg_sql_tests
mkdir -p benchdiff/d423221/bin/1058449141
gcloud storage cp gs://cockroach-microbench-ci/builds/d4232215214da4de11ec1ba71c88cd26a1f26573/bin/pkg_sql_tests benchdiff/d423221/bin/1058449141/cockroachdb_cockroach_pkg_sql_tests
chmod +x benchdiff/d423221/bin/1058449141/cockroachdb_cockroach_pkg_sql_tests

benchdiff command:

# NB: for best (most stable) results, also add a suitable `--benchtime` that
# results in ~1s to ~5s of benchmark runs. For example, if ops average ~3ms, a
# benchtime of `1000x` is appropriate.
#
# Some benchmarks (in particular BenchmarkSysbench) output additional memory
# profiles covering only the execution (excluding the setup/teardown) - those
# should be preferred for analysis since they more closely correspond to what's
# reported as B/op and alloc/op.
benchdiff --run=^BenchmarkSysbench/KV/3node/oltp_write_only$ --old=d423221 --new=8764856 --memprofile ./pkg/sql/tests
Artifacts

download:

mkdir -p new
gcloud storage cp gs://cockroach-microbench-ci/artifacts/8764856ac514c540d1925e2269fa207327ffbbe4/23099007788-1/\* new/
mkdir -p old
gcloud storage cp gs://cockroach-microbench-ci/artifacts/d4232215214da4de11ec1ba71c88cd26a1f26573/23099007788-1/\* old/

built with commit: 8764856ac514c540d1925e2269fa207327ffbbe4

@blathers-crl
Copy link

blathers-crl bot commented Mar 15, 2026

Detected infrastructure failure (matched: self-hosted runner lost communication with the server, self-hosted runner lost communication with the server, self-hosted runner lost communication with the server). Automatically rerunning failed jobs. (run link)

@cockroach-teamcity
Copy link
Member

⚪ Sysbench [SQL, 3node, oltp_read_write]
Metric Old Commit New Commit Delta Note
sec/op 10.51m ±5% 10.26m ±3% ~ p=0.187 n=15
allocs/op 8.125k ±0% 8.126k ±1% ~ p=0.878 n=15
Reproduce

benchdiff binaries:

mkdir -p benchdiff/fbfc865/bin/1058449141
gcloud storage cp gs://cockroach-microbench-ci/builds/fbfc86599c113313add11a70dcd7589ee359d9a2/bin/pkg_sql_tests benchdiff/fbfc865/bin/1058449141/cockroachdb_cockroach_pkg_sql_tests
chmod +x benchdiff/fbfc865/bin/1058449141/cockroachdb_cockroach_pkg_sql_tests
mkdir -p benchdiff/d423221/bin/1058449141
gcloud storage cp gs://cockroach-microbench-ci/builds/d4232215214da4de11ec1ba71c88cd26a1f26573/bin/pkg_sql_tests benchdiff/d423221/bin/1058449141/cockroachdb_cockroach_pkg_sql_tests
chmod +x benchdiff/d423221/bin/1058449141/cockroachdb_cockroach_pkg_sql_tests

benchdiff command:

# NB: for best (most stable) results, also add a suitable `--benchtime` that
# results in ~1s to ~5s of benchmark runs. For example, if ops average ~3ms, a
# benchtime of `1000x` is appropriate.
#
# Some benchmarks (in particular BenchmarkSysbench) output additional memory
# profiles covering only the execution (excluding the setup/teardown) - those
# should be preferred for analysis since they more closely correspond to what's
# reported as B/op and alloc/op.
benchdiff --run=^BenchmarkSysbench/SQL/3node/oltp_read_write$ --old=d423221 --new=fbfc865 --memprofile ./pkg/sql/tests
⚪ Sysbench [KV, 3node, oltp_read_only]
Metric Old Commit New Commit Delta Note
sec/op 3.054m ±0% 3.059m ±1% ~ p=0.775 n=15
allocs/op 2.107k ±0% 2.106k ±0% ~ p=0.457 n=15
Reproduce

benchdiff binaries:

mkdir -p benchdiff/fbfc865/bin/1058449141
gcloud storage cp gs://cockroach-microbench-ci/builds/fbfc86599c113313add11a70dcd7589ee359d9a2/bin/pkg_sql_tests benchdiff/fbfc865/bin/1058449141/cockroachdb_cockroach_pkg_sql_tests
chmod +x benchdiff/fbfc865/bin/1058449141/cockroachdb_cockroach_pkg_sql_tests
mkdir -p benchdiff/d423221/bin/1058449141
gcloud storage cp gs://cockroach-microbench-ci/builds/d4232215214da4de11ec1ba71c88cd26a1f26573/bin/pkg_sql_tests benchdiff/d423221/bin/1058449141/cockroachdb_cockroach_pkg_sql_tests
chmod +x benchdiff/d423221/bin/1058449141/cockroachdb_cockroach_pkg_sql_tests

benchdiff command:

# NB: for best (most stable) results, also add a suitable `--benchtime` that
# results in ~1s to ~5s of benchmark runs. For example, if ops average ~3ms, a
# benchtime of `1000x` is appropriate.
#
# Some benchmarks (in particular BenchmarkSysbench) output additional memory
# profiles covering only the execution (excluding the setup/teardown) - those
# should be preferred for analysis since they more closely correspond to what's
# reported as B/op and alloc/op.
benchdiff --run=^BenchmarkSysbench/KV/3node/oltp_read_only$ --old=d423221 --new=fbfc865 --memprofile ./pkg/sql/tests
⚪ Sysbench [KV, 3node, oltp_write_only]
Metric Old Commit New Commit Delta Note
sec/op 2.876m ±1% 2.883m ±0% ~ p=0.148 n=15
allocs/op 4.202k ±0% 4.204k ±0% ~ p=0.189 n=15
Reproduce

benchdiff binaries:

mkdir -p benchdiff/fbfc865/bin/1058449141
gcloud storage cp gs://cockroach-microbench-ci/builds/fbfc86599c113313add11a70dcd7589ee359d9a2/bin/pkg_sql_tests benchdiff/fbfc865/bin/1058449141/cockroachdb_cockroach_pkg_sql_tests
chmod +x benchdiff/fbfc865/bin/1058449141/cockroachdb_cockroach_pkg_sql_tests
mkdir -p benchdiff/d423221/bin/1058449141
gcloud storage cp gs://cockroach-microbench-ci/builds/d4232215214da4de11ec1ba71c88cd26a1f26573/bin/pkg_sql_tests benchdiff/d423221/bin/1058449141/cockroachdb_cockroach_pkg_sql_tests
chmod +x benchdiff/d423221/bin/1058449141/cockroachdb_cockroach_pkg_sql_tests

benchdiff command:

# NB: for best (most stable) results, also add a suitable `--benchtime` that
# results in ~1s to ~5s of benchmark runs. For example, if ops average ~3ms, a
# benchtime of `1000x` is appropriate.
#
# Some benchmarks (in particular BenchmarkSysbench) output additional memory
# profiles covering only the execution (excluding the setup/teardown) - those
# should be preferred for analysis since they more closely correspond to what's
# reported as B/op and alloc/op.
benchdiff --run=^BenchmarkSysbench/KV/3node/oltp_write_only$ --old=d423221 --new=fbfc865 --memprofile ./pkg/sql/tests
Artifacts

download:

mkdir -p new
gcloud storage cp gs://cockroach-microbench-ci/artifacts/fbfc86599c113313add11a70dcd7589ee359d9a2/23117394708-1/\* new/
mkdir -p old
gcloud storage cp gs://cockroach-microbench-ci/artifacts/d4232215214da4de11ec1ba71c88cd26a1f26573/23117394708-1/\* old/

built with commit: fbfc86599c113313add11a70dcd7589ee359d9a2

We expect that vast majority of implicit serializable txns don't benefit
from the buffered writes feature while we've seen some regressions
around blind writes, so this commit disables the buffered writes for all
implicit txns. As an escape hatch, a new session variable
`buffered_writes_implicit_txns_enabled` is introduced which can be set
to `true` to get the previous behavior (to increase test coverage the
default value for the session variable is metamorphically randomized in
test builds).

One notable case is worth calling out. In the PG wire protocol, entering
the extended protocol starts an implicit transaction which is then
upgraded to explicit if BEGIN is executed as a prepared statement. See
9fdb39b for more context.

Release note: None
@cockroach-teamcity
Copy link
Member

⚪ Sysbench [SQL, 3node, oltp_read_write]
Metric Old Commit New Commit Delta Note
sec/op 11.01m ±2% 10.91m ±2% ~ p=0.137 n=15
allocs/op 8.123k ±0% 8.128k ±1% ~ p=0.645 n=15
Reproduce

benchdiff binaries:

mkdir -p benchdiff/7b3a0e6/bin/1058449141
gcloud storage cp gs://cockroach-microbench-ci/builds/7b3a0e6e7173e1ee5ec0dd365937183d875e5d0b/bin/pkg_sql_tests benchdiff/7b3a0e6/bin/1058449141/cockroachdb_cockroach_pkg_sql_tests
chmod +x benchdiff/7b3a0e6/bin/1058449141/cockroachdb_cockroach_pkg_sql_tests
mkdir -p benchdiff/74eff75/bin/1058449141
gcloud storage cp gs://cockroach-microbench-ci/builds/74eff753539d441da4247b99f3fd408a3708fe1e/bin/pkg_sql_tests benchdiff/74eff75/bin/1058449141/cockroachdb_cockroach_pkg_sql_tests
chmod +x benchdiff/74eff75/bin/1058449141/cockroachdb_cockroach_pkg_sql_tests

benchdiff command:

# NB: for best (most stable) results, also add a suitable `--benchtime` that
# results in ~1s to ~5s of benchmark runs. For example, if ops average ~3ms, a
# benchtime of `1000x` is appropriate.
#
# Some benchmarks (in particular BenchmarkSysbench) output additional memory
# profiles covering only the execution (excluding the setup/teardown) - those
# should be preferred for analysis since they more closely correspond to what's
# reported as B/op and alloc/op.
benchdiff --run=^BenchmarkSysbench/SQL/3node/oltp_read_write$ --old=74eff75 --new=7b3a0e6 --memprofile ./pkg/sql/tests
⚪ Sysbench [KV, 3node, oltp_read_only]
Metric Old Commit New Commit Delta Note
sec/op 3.076m ±2% 3.091m ±1% ~ p=0.512 n=15
allocs/op 2.106k ±0% 2.106k ±0% ~ p=0.259 n=15
Reproduce

benchdiff binaries:

mkdir -p benchdiff/7b3a0e6/bin/1058449141
gcloud storage cp gs://cockroach-microbench-ci/builds/7b3a0e6e7173e1ee5ec0dd365937183d875e5d0b/bin/pkg_sql_tests benchdiff/7b3a0e6/bin/1058449141/cockroachdb_cockroach_pkg_sql_tests
chmod +x benchdiff/7b3a0e6/bin/1058449141/cockroachdb_cockroach_pkg_sql_tests
mkdir -p benchdiff/74eff75/bin/1058449141
gcloud storage cp gs://cockroach-microbench-ci/builds/74eff753539d441da4247b99f3fd408a3708fe1e/bin/pkg_sql_tests benchdiff/74eff75/bin/1058449141/cockroachdb_cockroach_pkg_sql_tests
chmod +x benchdiff/74eff75/bin/1058449141/cockroachdb_cockroach_pkg_sql_tests

benchdiff command:

# NB: for best (most stable) results, also add a suitable `--benchtime` that
# results in ~1s to ~5s of benchmark runs. For example, if ops average ~3ms, a
# benchtime of `1000x` is appropriate.
#
# Some benchmarks (in particular BenchmarkSysbench) output additional memory
# profiles covering only the execution (excluding the setup/teardown) - those
# should be preferred for analysis since they more closely correspond to what's
# reported as B/op and alloc/op.
benchdiff --run=^BenchmarkSysbench/KV/3node/oltp_read_only$ --old=74eff75 --new=7b3a0e6 --memprofile ./pkg/sql/tests
⚪ Sysbench [KV, 3node, oltp_write_only]
Metric Old Commit New Commit Delta Note
sec/op 2.959m ±1% 2.985m ±2% ~ p=0.806 n=15
allocs/op 4.212k ±0% 4.214k ±0% ~ p=0.644 n=15
Reproduce

benchdiff binaries:

mkdir -p benchdiff/7b3a0e6/bin/1058449141
gcloud storage cp gs://cockroach-microbench-ci/builds/7b3a0e6e7173e1ee5ec0dd365937183d875e5d0b/bin/pkg_sql_tests benchdiff/7b3a0e6/bin/1058449141/cockroachdb_cockroach_pkg_sql_tests
chmod +x benchdiff/7b3a0e6/bin/1058449141/cockroachdb_cockroach_pkg_sql_tests
mkdir -p benchdiff/74eff75/bin/1058449141
gcloud storage cp gs://cockroach-microbench-ci/builds/74eff753539d441da4247b99f3fd408a3708fe1e/bin/pkg_sql_tests benchdiff/74eff75/bin/1058449141/cockroachdb_cockroach_pkg_sql_tests
chmod +x benchdiff/74eff75/bin/1058449141/cockroachdb_cockroach_pkg_sql_tests

benchdiff command:

# NB: for best (most stable) results, also add a suitable `--benchtime` that
# results in ~1s to ~5s of benchmark runs. For example, if ops average ~3ms, a
# benchtime of `1000x` is appropriate.
#
# Some benchmarks (in particular BenchmarkSysbench) output additional memory
# profiles covering only the execution (excluding the setup/teardown) - those
# should be preferred for analysis since they more closely correspond to what's
# reported as B/op and alloc/op.
benchdiff --run=^BenchmarkSysbench/KV/3node/oltp_write_only$ --old=74eff75 --new=7b3a0e6 --memprofile ./pkg/sql/tests
Artifacts

download:

mkdir -p new
gcloud storage cp gs://cockroach-microbench-ci/artifacts/7b3a0e6e7173e1ee5ec0dd365937183d875e5d0b/23118556525-1/\* new/
mkdir -p old
gcloud storage cp gs://cockroach-microbench-ci/artifacts/74eff753539d441da4247b99f3fd408a3708fe1e/23118556525-1/\* old/

built with commit: 7b3a0e6e7173e1ee5ec0dd365937183d875e5d0b

@yuzefovich yuzefovich removed the X-perf-check Microbenchmarks CI: Added to a PR if a performance regression is detected and should be checked label Mar 15, 2026
@blathers-crl
Copy link

blathers-crl bot commented Mar 15, 2026

Detected infrastructure failure (matched: self-hosted runner lost communication with the server). Automatically rerunning failed jobs. (run link)

@yuzefovich yuzefovich marked this pull request as ready for review March 15, 2026 22:07
@yuzefovich
Copy link
Member Author

Ok, CI is green, so it's RFAL. Sorry for all the noise.

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.

sql: consider disabling buffered writes on implicit txns that don't benefit from them

2 participants