diff --git a/tikv-client/src/main/java/com/pingcap/tikv/predicates/TiKVScanAnalyzer.java b/tikv-client/src/main/java/com/pingcap/tikv/predicates/TiKVScanAnalyzer.java index 0fecec110d..9155a75d0b 100644 --- a/tikv-client/src/main/java/com/pingcap/tikv/predicates/TiKVScanAnalyzer.java +++ b/tikv-client/src/main/java/com/pingcap/tikv/predicates/TiKVScanAnalyzer.java @@ -117,7 +117,6 @@ public TiKVScanPlan build() { // TODO: Fine-grained statistics usage Builder calculateCostAndEstimateCount(long tableColSize) { - cost = 100.0; cost *= tableColSize * TABLE_SCAN_COST_FACTOR; return this; } @@ -277,6 +276,8 @@ TiKVScanPlan buildIndexScan( TiKVScanPlan.Builder planBuilder = TiKVScanPlan.Builder.newBuilder(); ScanSpec result = extractConditions(conditions, table, index); + // this is calcuated for downgrade if there is no statstics info we can + // retrieve from TiKV. double cost = SelectivityCalculator.calcPseudoSelectivity(result); planBuilder.setCost(cost);