Skip to content

Commit

Permalink
[Tech Request]: optimize non-pk index query for sysbench (matrixorigi…
Browse files Browse the repository at this point in the history
…n#20974)

[Tech Request]: optimize non-pk index query for sysbench

Approved by: @ouyuanning
  • Loading branch information
badboynt1 authored Dec 27, 2024
1 parent 3c84f22 commit 890bfec
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pkg/sql/plan/apply_indices.go
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ func (builder *QueryBuilder) applyIndicesForFiltersRegularIndex(nodeID int32, no

if catalog.IsFakePkName(node.TableDef.Pkey.PkeyColName) {
// for cluster by table, make it less prone to go index
if node.Stats.Selectivity > 0.0001 || node.Stats.Outcnt > 1000 {
if node.Stats.Selectivity >= InFilterSelectivityLimit/2 || node.Stats.Outcnt >= InFilterCardLimitNonPK {
return nodeID
}
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/sql/plan/runtime_filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const (
InFilterCardLimitNonPK = 10000
InFilterCardLimitPK = 1000000
BloomFilterCardLimit = 100 * InFilterCardLimitNonPK
InFilterSelectivityLimit = 0.2
InFilterSelectivityLimit = 0.3
)

func GetInFilterCardLimit(sid string) int32 {
Expand Down

0 comments on commit 890bfec

Please sign in to comment.