diff --git a/pkg/sql/opt/bench/BUILD.bazel b/pkg/sql/opt/bench/BUILD.bazel index ae81217d5eb9..c1d6184347d7 100644 --- a/pkg/sql/opt/bench/BUILD.bazel +++ b/pkg/sql/opt/bench/BUILD.bazel @@ -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", diff --git a/pkg/sql/opt/bench/bench_test.go b/pkg/sql/opt/bench/bench_test.go index fbedc0896e1f..79c457a2300e 100644 --- a/pkg/sql/opt/bench/bench_test.go +++ b/pkg/sql/opt/bench/bench_test.go @@ -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" @@ -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 {