Skip to content

Commit 969aff2

Browse files
committed
opt/bench: improve BenchmarkEndToEnd for INSERTs
In `BenchmarkEndToEnd` we have 3 bench cases where we have INSERT statements. Previously, we always used the same placeholder values, which forced us to do TRUNCATE TABLE after _every_ iteration, and that TRUNCATE was included into the operation time. We recently saw a supposed regression on this benchmark because the performance of TRUNCATE has regressed. In my initial approach I tried simply stopping and starting the timer around the TRUNCATE, but it made the benchmark extremely long. (Timer operations require stop-the-world pause, and since the time to perform TRUNCATE wasn't included into the benchmark time, now every single iteration seemed very short, so we'd do thousands of iterations with the default `bench-time=1s`, but truncating the table would make it about 1 minute instead.) To go around this issue I refactored three INSERT queries to generate slightly different arguments for each iteration so that we don't get PK duplicates and then moved the TRUNCATE outside the benchmark loop (and also excluded it from the timer). Now these benchmark cases truly measure what they were supposed to. Release note: None
1 parent 3b62960 commit 969aff2

File tree

1 file changed

+403
-200
lines changed

1 file changed

+403
-200
lines changed

0 commit comments

Comments
 (0)