@@ -741,7 +741,7 @@ func compareIndexBack(lhs, rhs *candidatePath) (int, bool) {
741
741
742
742
// compareCandidates is the core of skyline pruning, which is used to decide which candidate path is better.
743
743
// The return value is 1 if lhs is better, -1 if rhs is better, 0 if they are equivalent or not comparable.
744
- func compareCandidates (sctx base.PlanContext , statsTbl * statistics. Table , prop * property.PhysicalProperty , lhs , rhs * candidatePath ) int {
744
+ func compareCandidates (sctx base.PlanContext , prop * property.PhysicalProperty , lhs , rhs * candidatePath ) int {
745
745
// Due to #50125, full scan on MVIndex has been disabled, so MVIndex path might lead to 'can't find a proper plan' error at the end.
746
746
// Avoid MVIndex path to exclude all other paths and leading to 'can't find a proper plan' error, see #49438 for an example.
747
747
if isMVIndexPath (lhs .path ) || isMVIndexPath (rhs .path ) {
@@ -752,11 +752,11 @@ func compareCandidates(sctx base.PlanContext, statsTbl *statistics.Table, prop *
752
752
// has the same or higher number of equal/IN predicates.
753
753
lhsHasStatistics := statsTbl .Pseudo
754
754
if statsTbl != nil && lhs .path .Index != nil {
755
- lhsHasStatistics = statsTbl . ColAndIdxExistenceMap . HasAnalyzed ( lhs .path .Index .ID , true )
755
+ lhsHasStatistics = lhs .path .Index .IsAnalyzed ( )
756
756
}
757
757
rhsHasStatistics := statsTbl .Pseudo
758
758
if statsTbl != nil && rhs .path .Index != nil {
759
- rhsHasStatistics = statsTbl . ColAndIdxExistenceMap . HasAnalyzed ( rhs .path .Index .ID , true )
759
+ rhsHasStatistics = rhs .path .Index .IsAnalyzed ( )
760
760
}
761
761
if ! lhs .path .IsTablePath () && ! rhs .path .IsTablePath () && // Not a table scan
762
762
(lhsHasStatistics || rhsHasStatistics ) && // At least one index has statistics
@@ -942,7 +942,7 @@ func (ds *DataSource) skylinePruning(prop *property.PhysicalProperty) []*candida
942
942
if candidates [i ].path .StoreType == kv .TiFlash {
943
943
continue
944
944
}
945
- result := compareCandidates (ds .SCtx (), ds . StatisticTable , prop , candidates [i ], currentCandidate )
945
+ result := compareCandidates (ds .SCtx (), prop , candidates [i ], currentCandidate )
946
946
if result == 1 {
947
947
pruned = true
948
948
// We can break here because the current candidate cannot prune others anymore.
0 commit comments