Skip to content

Commit

Permalink
optimize stats for runtime filters when table not flushed (#20717)
Browse files Browse the repository at this point in the history
optimize stats for runtime filters when table not flushed

Approved by: @ouyuanning
  • Loading branch information
badboynt1 authored Dec 11, 2024
1 parent 16e9b56 commit 5d82985
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/sql/plan/runtime_filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,11 @@ func (builder *QueryBuilder) generateRuntimeFilters(nodeID int32) {
sortOrder := GetSortOrder(tableDef, probeCol.ColPos)
if node.JoinType != plan.Node_INDEX {
probeNdv := getExprNdv(probeExprs[0], builder)
if probeNdv == -1 || node.Stats.HashmapStats.HashmapSize/probeNdv >= 0.1 {
if probeNdv <= 1 {
//maybe not flushed yet, set at least 100 to continue calculation
probeNdv = 100
}
if node.Stats.HashmapStats.HashmapSize/probeNdv >= 0.1 {
return
}
if sortOrder != 0 {
Expand Down

0 comments on commit 5d82985

Please sign in to comment.