Skip to content

Commit

Permalink
opt: set default session settings in micro-benchmarks
Browse files Browse the repository at this point in the history
Setting the default session settings makes the micro-benchmarks more
representative of real-world workloads.

Epic: None

Release note: None
  • Loading branch information
mgartner committed Dec 13, 2022
1 parent da0dace commit 7f8a334
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pkg/sql/opt/bench/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ go_test(
"//pkg/server",
"//pkg/settings/cluster",
"//pkg/sql/catalog/schemaexpr",
"//pkg/sql/catalog/tabledesc",
"//pkg/sql/opt",
"//pkg/sql/opt/exec",
"//pkg/sql/opt/exec/execbuilder",
"//pkg/sql/opt/exec/explain",
Expand Down
14 changes: 14 additions & 0 deletions pkg/sql/opt/bench/bench_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ import (
"github.com/cockroachdb/cockroach/pkg/server"
"github.com/cockroachdb/cockroach/pkg/settings/cluster"
"github.com/cockroachdb/cockroach/pkg/sql/catalog/schemaexpr"
"github.com/cockroachdb/cockroach/pkg/sql/catalog/tabledesc"
"github.com/cockroachdb/cockroach/pkg/sql/opt"
"github.com/cockroachdb/cockroach/pkg/sql/opt/exec"
"github.com/cockroachdb/cockroach/pkg/sql/opt/exec/execbuilder"
"github.com/cockroachdb/cockroach/pkg/sql/opt/exec/explain"
Expand Down Expand Up @@ -591,6 +593,18 @@ func newHarness(tb testing.TB, query benchQuery, schemas []string) *harness {
evalCtx: eval.MakeTestingEvalContext(cluster.MakeTestingClusterSettings()),
}

// Setup the default session settings.
h.evalCtx.SessionData().ReorderJoinsLimit = opt.DefaultJoinOrderLimit
h.evalCtx.SessionData().OptimizerUseMultiColStats = true
h.evalCtx.SessionData().ZigzagJoinEnabled = true
h.evalCtx.SessionData().OptimizerUseForecasts = true
h.evalCtx.SessionData().OptimizerUseHistograms = true
h.evalCtx.SessionData().LocalityOptimizedSearch = true
h.evalCtx.SessionData().ReorderJoinsLimit = opt.DefaultJoinOrderLimit
h.evalCtx.SessionData().InsertFastPath = true
h.evalCtx.SessionData().OptSplitScanLimit = tabledesc.MaxBucketAllowed
h.evalCtx.SessionData().VariableInequalityLookupJoinEnabled = true

// Set up the test catalog.
h.testCat = testcat.New()
for _, schema := range schemas {
Expand Down

0 comments on commit 7f8a334

Please sign in to comment.