diff --git a/bench_test.go b/bench_test.go index 402791a9fdd41..7d191a3b53062 100644 --- a/bench_test.go +++ b/bench_test.go @@ -62,6 +62,10 @@ func prepareSortBenchData(se Session, colType string, valueFormat string, valueC mustExecute(se, "begin") r := rand.New(rand.NewSource(time.Now().UnixNano())) for i := 0; i < valueCount; i++ { + if i%1000 == 0 { + mustExecute(se, "commit") + mustExecute(se, "begin") + } mustExecute(se, "insert t (col) values ("+fmt.Sprintf(valueFormat, r.Intn(valueCount))+")") } mustExecute(se, "commit") @@ -93,7 +97,9 @@ func readResult(goCtx goctx.Context, rs ast.RecordSet, count int) { func BenchmarkBasic(b *testing.B) { goCtx := goctx.Background() + b.StopTimer() se := prepareBenchSession() + b.StartTimer() for i := 0; i < b.N; i++ { rs, err := se.Execute(goCtx, "select 1") if err != nil {