Skip to content

Commit

Permalink
Merge #106730
Browse files Browse the repository at this point in the history
106730: tenantcostclient: speed up query RU estimate test r=yuzefovich a=yuzefovich

This commit speeds up the query RU estimate test in two ways:
- it forces the production values for some of the metamorphic constants (this brought down the runtime from 93s to 37s for a particular seed)
- it reduces the number of rows inserted from 50k to 20k which should be (further bringing down the runtime to 13s).

Fixes: #106350.

Release note: None

Co-authored-by: Yahor Yuzefovich <yahor@cockroachlabs.com>
  • Loading branch information
craig[bot] and yuzefovich committed Jul 13, 2023
2 parents b3c64ee + bd9317e commit 907479d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions pkg/ccl/multitenantccl/tenantcostclient/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ go_test(
"//pkg/sql/catalog/systemschema",
"//pkg/sql/distsql",
"//pkg/sql/execinfra",
"//pkg/sql/sem/eval",
"//pkg/sql/sqlliveness",
"//pkg/sql/sqlliveness/slinstance",
"//pkg/sql/stats",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
_ "github.com/cockroachdb/cockroach/pkg/ccl/multitenantccl/tenantcostserver"
"github.com/cockroachdb/cockroach/pkg/kv/kvpb"
"github.com/cockroachdb/cockroach/pkg/settings/cluster"
"github.com/cockroachdb/cockroach/pkg/sql/sem/eval"
"github.com/cockroachdb/cockroach/pkg/sql/stats"
"github.com/cockroachdb/cockroach/pkg/testutils/serverutils"
"github.com/cockroachdb/cockroach/pkg/testutils/skip"
Expand Down Expand Up @@ -74,6 +75,13 @@ func TestEstimateQueryRUConsumption(t *testing.T) {
tenant1, tenantDB1 := serverutils.StartTenant(t, s, base.TestTenantArgs{
TenantID: tenantID,
Settings: st,
TestingKnobs: base.TestingKnobs{
SQLEvalContext: &eval.TestingKnobs{
// We disable the randomization of some batch sizes because with
// some low values the test takes much longer.
ForceProductionValues: true,
},
},
})
defer tenant1.Stopper().Stop(ctx)
defer tenantDB1.Close()
Expand All @@ -87,7 +95,7 @@ func TestEstimateQueryRUConsumption(t *testing.T) {
}
testCases := []testCase{
{ // Insert statement
sql: "INSERT INTO abcd (SELECT t%2, t%3, t, -t FROM generate_series(1,50000) g(t))",
sql: "INSERT INTO abcd (SELECT t%2, t%3, t, -t FROM generate_series(1,20000) g(t))",
count: 1,
},
{ // Point query
Expand Down

0 comments on commit 907479d

Please sign in to comment.