Skip to content

Commit 3c9e677

Browse files
committed
vecindex: remove search_beam_size cluster setting
The `sql.vecindex.search_beam_size` cluster setting only exists to specify the default value for the vector_search_beam_size session setting. However, this is not necessary; session settings can specify a default value on their own. This commit removes the cluster setting and sets the global default to be "32" for the session setting. Epic: CRDB-42943 Release note: None
1 parent 5f658ad commit 3c9e677

File tree

3 files changed

+8
-17
lines changed

3 files changed

+8
-17
lines changed

pkg/settings/registry.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,8 +271,13 @@ var retiredSettings = map[InternalKey]struct{}{
271271

272272
// grandfatheredDefaultSettings is the list of "grandfathered" existing sql.defaults
273273
// cluster settings. In 22.2 and later, new session settings do not need an
274-
// associated sql.defaults cluster setting. Instead they can have their default
275-
// changed with ALTER ROLE ... SET.
274+
// associated sql.defaults cluster setting (see the `vector_search_beam_size`
275+
// setting in vars.go for an example). A session setting can have its default
276+
// changed with ALTER ROLE ... SET, similar to this (the example assumes that
277+
// all roles should use the new default):
278+
//
279+
// ALTER ROLE ALL SET vector_search_beam_size=128;
280+
//
276281
// Caveat: in some cases, we may still add new sql.defaults cluster settings,
277282
// but the new ones *must* be marked as non-public. Undocumented settings are
278283
// excluded from the check that prevents new sql.defaults settings. The

pkg/sql/vars.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ import (
4040
"github.com/cockroachdb/cockroach/pkg/sql/sessiondata"
4141
"github.com/cockroachdb/cockroach/pkg/sql/sessiondatapb"
4242
"github.com/cockroachdb/cockroach/pkg/sql/sqltelemetry"
43-
"github.com/cockroachdb/cockroach/pkg/sql/vecindex"
4443
"github.com/cockroachdb/cockroach/pkg/util/duration"
4544
"github.com/cockroachdb/cockroach/pkg/util/errorutil/unimplemented"
4645
"github.com/cockroachdb/cockroach/pkg/util/hlc"
@@ -3998,7 +3997,7 @@ var varGen = map[string]sessionVar{
39983997
return strconv.FormatInt(int64(evalCtx.SessionData().VectorSearchBeamSize), 10), nil
39993998
},
40003999
GlobalDefault: func(sv *settings.Values) string {
4001-
return strconv.FormatInt(vecindex.SearchBeamSizeSetting.Get(sv), 10)
4000+
return "32"
40024001
},
40034002
},
40044003
}

pkg/sql/vecindex/settings.go

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -44,19 +44,6 @@ var StalledOpTimeoutSetting = settings.RegisterDurationSetting(
4444
settings.WithPublic,
4545
)
4646

47-
// SearchBeamSizeSetting controls the number of candidates examined during
48-
// vector index searches. It represents the number of vector partitions that are
49-
// are considered at each level of the search tree. Higher values increase
50-
// search accuracy but require more processing resources.
51-
var SearchBeamSizeSetting = settings.RegisterIntSetting(
52-
settings.ApplicationLevel,
53-
"sql.vecindex.search_beam_size",
54-
"number of vector partitions searched at each level of the search tree "+
55-
"(higher values increase accuracy but require more processing)",
56-
32,
57-
settings.IntInRange(1, 512),
58-
)
59-
6047
// VectorIndexEnabled is used to enable and disable vector indexes.
6148
var VectorIndexEnabled = settings.RegisterBoolSetting(
6249
settings.ApplicationLevel,

0 commit comments

Comments
 (0)