[ { "Name": "TestTraceCE", "Cases": [ { "Expr": "a > 0 and a < 2", "Trace": [ { "table_name": "t", "type": "Column Stats-Point", "expr": "((a = 1))", "row_count": 4 }, { "table_name": "t", "type": "Index Stats-Point", "expr": "((a = 1))", "row_count": 4 }, { "table_name": "t", "type": "Column Stats-Range", "expr": "((a > 0 and a < 2))", "row_count": 4 }, { "table_name": "t", "type": "Table Stats-Expression-CNF", "expr": "`and`(`gt`(test.t.a, 0), `lt`(test.t.a, 2))", "row_count": 4 } ] }, { "Expr": "a >= 1 and a < 10", "Trace": [ { "table_name": "t", "type": "Index Stats-Range", "expr": "((a >= 1 and a < 10))", "row_count": 6 }, { "table_name": "t", "type": "Column Stats-Range", "expr": "((a >= 1 and a < 10))", "row_count": 6 }, { "table_name": "t", "type": "Table Stats-Expression-CNF", "expr": "`and`(`ge`(test.t.a, 1), `lt`(test.t.a, 10))", "row_count": 6 } ] }, { "Expr": "a < 3 or b < 4", "Trace": [ { "table_name": "t", "type": "Column Stats-Range", "expr": "((b < 4))", "row_count": 6 }, { "table_name": "t", "type": "Table Stats-Expression-CNF", "expr": "`lt`(test.t.b, 4)", "row_count": 6 }, { "table_name": "t", "type": "Table Stats-Expression-DNF", "expr": "`or`(`lt`(test.t.a, 3), `lt`(test.t.b, 4))", "row_count": 6 }, { "table_name": "t", "type": "Column Stats-Range", "expr": "((a < 3))", "row_count": 6 }, { "table_name": "t", "type": "Index Stats-Range", "expr": "((a < 3))", "row_count": 6 }, { "table_name": "t", "type": "Table Stats-Expression-CNF", "expr": "`lt`(test.t.a, 3)", "row_count": 6 }, { "table_name": "t", "type": "Table Stats-Expression-CNF", "expr": "`or`(`lt`(test.t.a, 3), `lt`(test.t.b, 4))", "row_count": 6 } ] }, { "Expr": "a = 1 and b = 2", "Trace": [ { "table_name": "t", "type": "Index Stats-Point", "expr": "((a = 1) and (b = 2))", "row_count": 2 }, { "table_name": "t", "type": "Column Stats-Point", "expr": "((a = 1))", "row_count": 4 }, { "table_name": "t", "type": "Column Stats-Point", "expr": "((b = 2))", "row_count": 3 }, { "table_name": "t", "type": "Table Stats-Expression-CNF", "expr": "`and`(`eq`(test.t.a, 1), `eq`(test.t.b, 2))", "row_count": 2 } ] }, { "Expr": "a < 5 or a > 10", "Trace": [ { "table_name": "t", "type": "Index Stats-Range", "expr": "((a < 5)) or ((a > 10 and true))", "row_count": 6 }, { "table_name": "t", "type": "Column Stats-Range", "expr": "((a < 5)) or ((a > 10 and true))", "row_count": 6 }, { "table_name": "t", "type": "Table Stats-Expression-CNF", "expr": "`or`(`lt`(test.t.a, 5), `gt`(test.t.a, 10))", "row_count": 6 } ] } ] }, { "Name": "TestTraceDebugSelectivity", "Cases": [ { "ResultForV1": [ { "github.com/pingcap/tidb/statistics.(*HistColl).Selectivity": [ { "Input Expressions": [ "eq(test.t.a, 100)", "eq(test.t.b, 350)" ] }, { "github.com/pingcap/tidb/statistics.(*HistColl).GetRowCountByColumnRanges": [ { "ID": 1, "Ranges": [ "[100,100]" ] }, { "github.com/pingcap/tidb/statistics.(*Column).IsInvalid": { "EssentialLoaded": true, "InValidForCollPseudo": false, "IsInvalid": false, "NDV": 2001, "TotalCount": 3080 } }, { "Histogram NotNull Count": 3080, "Increase Factor": 1, "TopN total count": 1095 }, { "github.com/pingcap/tidb/statistics.(*Column).GetColumnRowCount": [ { "Start estimate range": { "CurrentRowCount": 0, "HighValueEncoded": "A4AAAAAAAABk", "LowValueEncoded": "A4AAAAAAAABk", "Range": "[100,100]" } }, { "github.com/pingcap/tidb/statistics.(*Column).equalRowCount": [ { "Encoded": "A4AAAAAAAABk", "Value": "KindInt64 100" }, { "github.com/pingcap/tidb/statistics.(*TopN).QueryTopN": [ { "FindTopN idx": 13 }, { "Found": true, "Result": 50 } ] }, { "Error": null, "Result": 50 } ] }, { "End estimate range": { "RowCount": 50, "Type": "Point" } } ] }, { "Name": "a", "Result": 50 } ] }, { "github.com/pingcap/tidb/statistics.(*HistColl).GetRowCountByColumnRanges": [ { "ID": 2, "Ranges": [ "[350,350]" ] }, { "github.com/pingcap/tidb/statistics.(*Column).IsInvalid": { "EssentialLoaded": true, "InValidForCollPseudo": false, "IsInvalid": false, "NDV": 2001, "TotalCount": 3080 } }, { "Histogram NotNull Count": 3080, "Increase Factor": 1, "TopN total count": 1098 }, { "github.com/pingcap/tidb/statistics.(*Column).GetColumnRowCount": [ { "Start estimate range": { "CurrentRowCount": 0, "HighValueEncoded": "A4AAAAAAAAFe", "LowValueEncoded": "A4AAAAAAAAFe", "Range": "[350,350]" } }, { "github.com/pingcap/tidb/statistics.(*Column).equalRowCount": [ { "Encoded": "A4AAAAAAAAFe", "Value": "KindInt64 350" }, { "github.com/pingcap/tidb/statistics.(*TopN).QueryTopN": [ { "FindTopN idx": -1 }, { "Found": false, "Result": 0 } ] }, { "github.com/pingcap/tidb/statistics.(*CMSketch).queryHashValue": { "Origin Values": [ 3, 3, 2, 1, 1 ], "Result": 1, "Use default value": false, "Values": [ 2, 2, 3, 4, 4 ] } }, { "Error": null, "Result": 1 } ] }, { "End estimate range": { "RowCount": 1, "Type": "Point" } } ] }, { "Name": "b", "Result": 1 } ] }, { "github.com/pingcap/tidb/statistics.(*HistColl).GetRowCountByIndexRanges": [ { "ID": 1, "Ranges": [ "[100 350,100 350]" ] }, { "github.com/pingcap/tidb/statistics.(*Index).IsInvalid": { "CollPseudo": false, "IsInvalid": false, "NotAccurate": true, "TotalCount": 3080 } }, { "Histogram NotNull Count": 3080, "Increase Factor": 1, "TopN total count": 0 }, { "github.com/pingcap/tidb/statistics.(*HistColl).getIndexRowCount": [ { "Start estimate range": { "CurrentRowCount": 0, "HighValueEncoded": null, "LowValueEncoded": null, "Range": "[100 350,100 350]" } }, { "github.com/pingcap/tidb/statistics.(*HistColl).getEqualCondSelectivity": [ { "github.com/pingcap/tidb/statistics.(*HistColl).crossValidationSelectivity": [ { "github.com/pingcap/tidb/statistics.(*Column).IsInvalid": { "EssentialLoaded": true, "InValidForCollPseudo": false, "IsInvalid": false, "NDV": 2001, "TotalCount": 3080 } }, { "github.com/pingcap/tidb/statistics.(*Column).GetColumnRowCount": [ { "Start estimate range": { "CurrentRowCount": 0, "HighValueEncoded": "A4AAAAAAAABk", "LowValueEncoded": "A4AAAAAAAABk", "Range": "[100,100]" } }, { "github.com/pingcap/tidb/statistics.(*Column).equalRowCount": [ { "Encoded": "A4AAAAAAAABk", "Value": "KindInt64 100" }, { "github.com/pingcap/tidb/statistics.(*TopN).QueryTopN": [ { "FindTopN idx": 13 }, { "Found": true, "Result": 50 } ] }, { "Error": null, "Result": 50 } ] }, { "End estimate range": { "RowCount": 50, "Type": "Point" } } ] }, { "github.com/pingcap/tidb/statistics.(*Column).IsInvalid": { "EssentialLoaded": true, "InValidForCollPseudo": false, "IsInvalid": false, "NDV": 2001, "TotalCount": 3080 } }, { "github.com/pingcap/tidb/statistics.(*Column).GetColumnRowCount": [ { "Start estimate range": { "CurrentRowCount": 0, "HighValueEncoded": "A4AAAAAAAAFe", "LowValueEncoded": "A4AAAAAAAAFe", "Range": "[350,350]" } }, { "github.com/pingcap/tidb/statistics.(*Column).equalRowCount": [ { "Encoded": "A4AAAAAAAAFe", "Value": "KindInt64 350" }, { "github.com/pingcap/tidb/statistics.(*TopN).QueryTopN": [ { "FindTopN idx": -1 }, { "Found": false, "Result": 0 } ] }, { "github.com/pingcap/tidb/statistics.(*CMSketch).queryHashValue": { "Origin Values": [ 3, 3, 2, 1, 1 ], "Result": 1, "Use default value": false, "Values": [ 2, 2, 3, 4, 4 ] } }, { "Error": null, "Result": 1 } ] }, { "End estimate range": { "RowCount": 1, "Type": "Point" } } ] }, { "Index Name": "iab", "crossValidationSelectivity": 0.0000052707033226513745, "error": null, "minRowCount": 1 } ] }, { "github.com/pingcap/tidb/statistics.(*Index).QueryBytes": [ { "github.com/pingcap/tidb/statistics.(*CMSketch).queryHashValue": { "Origin Values": [ 3, 3, 0, 2, 2 ], "Result": 3, "Use default value": true, "Values": [ 0, 1, 1, 1, 1 ] } }, { "Result": 3 } ] }, { "Encoded": "A4AAAAAAAABkA4AAAAAAAAFe", "Index Name": "iab", "Range": "[100 350,100 350]", "Result": 0.0000052707033226513745, "UsedColLen": 2, "error": null } ] }, { "End estimate range": { "RowCount": 0.016233766233766232, "Type": "Range" } } ] }, { "Name": "iab", "Result": 0.016233766233766232 } ] }, { "github.com/pingcap/tidb/statistics.(*HistColl).GetRowCountByIndexRanges": [ { "ID": 2, "Ranges": [ "[350,350]" ] }, { "github.com/pingcap/tidb/statistics.(*Index).IsInvalid": { "CollPseudo": false, "IsInvalid": false, "NotAccurate": true, "TotalCount": 3080 } }, { "Histogram NotNull Count": 3080, "Increase Factor": 1, "TopN total count": 0 }, { "github.com/pingcap/tidb/statistics.(*HistColl).getIndexRowCount": [ { "Start estimate range": { "CurrentRowCount": 0, "HighValueEncoded": null, "LowValueEncoded": null, "Range": "[350,350]" } }, { "github.com/pingcap/tidb/statistics.(*HistColl).getEqualCondSelectivity": [ { "github.com/pingcap/tidb/statistics.(*HistColl).crossValidationSelectivity": [ { "github.com/pingcap/tidb/statistics.(*Column).IsInvalid": { "EssentialLoaded": true, "InValidForCollPseudo": false, "IsInvalid": false, "NDV": 2001, "TotalCount": 3080 } }, { "github.com/pingcap/tidb/statistics.(*Column).GetColumnRowCount": [ { "Start estimate range": { "CurrentRowCount": 0, "HighValueEncoded": "A4AAAAAAAAFe", "LowValueEncoded": "A4AAAAAAAAFe", "Range": "[350,350]" } }, { "github.com/pingcap/tidb/statistics.(*Column).equalRowCount": [ { "Encoded": "A4AAAAAAAAFe", "Value": "KindInt64 350" }, { "github.com/pingcap/tidb/statistics.(*TopN).QueryTopN": [ { "FindTopN idx": -1 }, { "Found": false, "Result": 0 } ] }, { "github.com/pingcap/tidb/statistics.(*CMSketch).queryHashValue": { "Origin Values": [ 3, 3, 2, 1, 1 ], "Result": 1, "Use default value": false, "Values": [ 2, 2, 3, 4, 4 ] } }, { "Error": null, "Result": 1 } ] }, { "End estimate range": { "RowCount": 1, "Type": "Point" } } ] }, { "Index Name": "ib", "crossValidationSelectivity": 0.0003246753246753247, "error": null, "minRowCount": 1 } ] }, { "github.com/pingcap/tidb/statistics.(*Index).QueryBytes": [ { "github.com/pingcap/tidb/statistics.(*CMSketch).queryHashValue": { "Origin Values": [ 2, 2, 1, 1, 1 ], "Result": 1, "Use default value": true, "Values": [ 1, 1, 1, 2, 2 ] } }, { "Result": 1 } ] }, { "Encoded": "A4AAAAAAAAFe", "Index Name": "ib", "Range": "[350,350]", "Result": 0.0003246753246753247, "UsedColLen": 1, "error": null } ] }, { "End estimate range": { "RowCount": 1, "Type": "Range" } } ] }, { "Name": "ib", "Result": 1 } ] }, { "Expressions": [ "eq(test.t.a, 100)", "eq(test.t.b, 350)" ], "Selectivity": 0.0000052707033226513745, "partial cover": false }, { "Result": 0.0000052707033226513745 } ] } ], "ResultForV2": [ { "github.com/pingcap/tidb/statistics.(*HistColl).Selectivity": [ { "Input Expressions": [ "eq(test.t.a, 100)", "eq(test.t.b, 350)" ] }, { "github.com/pingcap/tidb/statistics.(*HistColl).GetRowCountByColumnRanges": [ { "ID": 1, "Ranges": [ "[100,100]" ] }, { "github.com/pingcap/tidb/statistics.(*Column).IsInvalid": { "EssentialLoaded": true, "InValidForCollPseudo": false, "IsInvalid": false, "NDV": 2000, "TotalCount": 2980 } }, { "Histogram NotNull Count": 1980, "Increase Factor": 1.0335570469798658, "TopN total count": 1000 }, { "github.com/pingcap/tidb/statistics.(*Column).GetColumnRowCount": [ { "Start estimate range": { "CurrentRowCount": 0, "HighValueEncoded": "A4AAAAAAAABk", "LowValueEncoded": "A4AAAAAAAABk", "Range": "[100,100]" } }, { "github.com/pingcap/tidb/statistics.(*Column).equalRowCount": [ { "Encoded": "A4AAAAAAAABk", "Value": "KindInt64 100" }, { "github.com/pingcap/tidb/statistics.(*TopN).QueryTopN": [ { "FindTopN idx": 11 }, { "Found": true, "Result": 50 } ] }, { "Error": null, "Result": 50 } ] }, { "End estimate range": { "RowCount": 51.67785234899329, "Type": "Point" } } ] }, { "Name": "a", "Result": 51.67785234899329 } ] }, { "github.com/pingcap/tidb/statistics.(*HistColl).GetRowCountByColumnRanges": [ { "ID": 2, "Ranges": [ "[350,350]" ] }, { "github.com/pingcap/tidb/statistics.(*Column).IsInvalid": { "EssentialLoaded": true, "InValidForCollPseudo": false, "IsInvalid": false, "NDV": 2000, "TotalCount": 2980 } }, { "Histogram NotNull Count": 1980, "Increase Factor": 1.0335570469798658, "TopN total count": 1000 }, { "github.com/pingcap/tidb/statistics.(*Column).GetColumnRowCount": [ { "Start estimate range": { "CurrentRowCount": 0, "HighValueEncoded": "A4AAAAAAAAFe", "LowValueEncoded": "A4AAAAAAAAFe", "Range": "[350,350]" } }, { "github.com/pingcap/tidb/statistics.(*Column).equalRowCount": [ { "Encoded": "A4AAAAAAAAFe", "Value": "KindInt64 350" }, { "github.com/pingcap/tidb/statistics.(*TopN).QueryTopN": [ { "FindTopN idx": -1 }, { "Found": false, "Result": 0 } ] }, { "github.com/pingcap/tidb/statistics.(*Histogram).equalRowCount": [ { "Locate value in buckets": { "BucketIdx": 105, "Exceed": false, "InBucket": true, "MatchLastValue": false, "Value": "KindInt64 350" } }, { "Related Buckets in Histogram": [ { "Count": 848, "Index": 105, "Repeat": 1 } ] }, { "Count": 0.99, "Matched": false } ] }, { "Error": null, "Result": 1 } ] }, { "End estimate range": { "RowCount": 1.0335570469798658, "Type": "Point" } } ] }, { "Name": "b", "Result": 1.0335570469798658 } ] }, { "github.com/pingcap/tidb/statistics.(*HistColl).GetRowCountByIndexRanges": [ { "ID": 1, "Ranges": [ "[100 350,100 350]" ] }, { "github.com/pingcap/tidb/statistics.(*Index).IsInvalid": { "CollPseudo": false, "IsInvalid": false, "NotAccurate": true, "TotalCount": 2980 } }, { "Histogram NotNull Count": 1980, "Increase Factor": 1.0335570469798658, "TopN total count": 1000 }, { "github.com/pingcap/tidb/statistics.(*Index).GetRowCount": [ { "Start estimate range": { "CurrentRowCount": 0, "HighValueEncoded": "A4AAAAAAAABkA4AAAAAAAAFe", "LowValueEncoded": "A4AAAAAAAABkA4AAAAAAAAFe", "Range": "[100 350,100 350]" } }, { "github.com/pingcap/tidb/statistics.(*Index).equalRowCount": [ { "Encoded Value": "A4AAAAAAAABkA4AAAAAAAAFe" }, { "github.com/pingcap/tidb/statistics.(*TopN).QueryTopN": [ { "FindTopN idx": -1 }, { "Found": false, "Result": 0 } ] }, { "github.com/pingcap/tidb/statistics.(*Histogram).equalRowCount": [ { "Locate value in buckets": { "BucketIdx": 136, "Exceed": false, "InBucket": true, "MatchLastValue": false, "Value": "KindBytes \\x03\\x80\\x00\\x00\\x00\\x00\\x00\\x00d\\x03\\x80\\x00\\x00\\x00\\x00\\x00\\x01^" } }, { "Related Buckets in Histogram": [ { "Count": 1096, "Index": 136, "Repeat": 1 } ] }, { "Count": 0.99, "Matched": false } ] }, { "Result": 1 } ] }, { "End estimate range": { "RowCount": 1.0335570469798658, "Type": "Point" } } ] }, { "Name": "iab", "Result": 1.0335570469798658 } ] }, { "github.com/pingcap/tidb/statistics.(*HistColl).GetRowCountByIndexRanges": [ { "ID": 2, "Ranges": [ "[350,350]" ] }, { "github.com/pingcap/tidb/statistics.(*Index).IsInvalid": { "CollPseudo": false, "IsInvalid": false, "NotAccurate": true, "TotalCount": 2980 } }, { "Histogram NotNull Count": 1980, "Increase Factor": 1.0335570469798658, "TopN total count": 1000 }, { "github.com/pingcap/tidb/statistics.(*Index).GetRowCount": [ { "Start estimate range": { "CurrentRowCount": 0, "HighValueEncoded": "A4AAAAAAAAFe", "LowValueEncoded": "A4AAAAAAAAFe", "Range": "[350,350]" } }, { "github.com/pingcap/tidb/statistics.(*Index).equalRowCount": [ { "Encoded Value": "A4AAAAAAAAFe" }, { "github.com/pingcap/tidb/statistics.(*TopN).QueryTopN": [ { "FindTopN idx": -1 }, { "Found": false, "Result": 0 } ] }, { "github.com/pingcap/tidb/statistics.(*Histogram).equalRowCount": [ { "Locate value in buckets": { "BucketIdx": 105, "Exceed": false, "InBucket": true, "MatchLastValue": false, "Value": "KindBytes \\x03\\x80\\x00\\x00\\x00\\x00\\x00\\x01^" } }, { "Related Buckets in Histogram": [ { "Count": 848, "Index": 105, "Repeat": 1 } ] }, { "Count": 0.99, "Matched": false } ] }, { "Result": 1 } ] }, { "End estimate range": { "RowCount": 1.0335570469798658, "Type": "Point" } } ] }, { "Name": "ib", "Result": 1.0335570469798658 } ] }, { "Expressions": [ "eq(test.t.a, 100)", "eq(test.t.b, 350)" ], "Selectivity": 0.00033557046979865775, "partial cover": false }, { "Result": 0.00033557046979865775 } ] } ] }, { "ResultForV1": [ { "github.com/pingcap/tidb/statistics.(*HistColl).Selectivity": [ { "Input Expressions": [ "lt(test.t.a, -1500)", "gt(test.t.b, 400)", "lt(test.t.b, 403)" ] }, { "github.com/pingcap/tidb/statistics.(*HistColl).GetRowCountByColumnRanges": [ { "ID": 1, "Ranges": [ "[-inf,-1500)" ] }, { "github.com/pingcap/tidb/statistics.(*Column).IsInvalid": { "EssentialLoaded": true, "InValidForCollPseudo": false, "IsInvalid": false, "NDV": 2001, "TotalCount": 3080 } }, { "Histogram NotNull Count": 3080, "Increase Factor": 1, "TopN total count": 1095 }, { "github.com/pingcap/tidb/statistics.(*Column).GetColumnRowCount": [ { "Start estimate range": { "CurrentRowCount": 0, "HighValueEncoded": "A3////////ok", "LowValueEncoded": "AQ==", "Range": "[-inf,-1500)" } }, { "github.com/pingcap/tidb/statistics.(*Histogram).LessRowCountWithBktIdx": [ { "Locate value in buckets": { "BucketIdx": 0, "Exceed": false, "InBucket": false, "MatchLastValue": false, "Value": "KindMinNotNull " } }, { "Related Buckets in Histogram": [ { "Count": -1, "Index": -1, "Repeat": -1 }, { "Count": 50, "Index": 0, "Repeat": 50 } ] }, { "Bucket idx": 0, "Result": 0 } ] }, { "github.com/pingcap/tidb/statistics.(*Histogram).LessRowCountWithBktIdx": [ { "Locate value in buckets": { "BucketIdx": 0, "Exceed": false, "InBucket": false, "MatchLastValue": false, "Value": "KindInt64 -1500" } }, { "Related Buckets in Histogram": [ { "Count": -1, "Index": -1, "Repeat": -1 }, { "Count": 50, "Index": 0, "Repeat": 50 } ] }, { "Bucket idx": 0, "Result": 0 } ] }, { "github.com/pingcap/tidb/statistics.(*Histogram).outOfRangeRowCount": [ { "lDatum": "KindMinNotNull ", "modifyCount": 0, "rDatum": "KindInt64 -1500" }, { "commonPrefix": 0, "lScalar": -1.7976931348623157e+308, "rScalar": -1500, "unsigned": false }, { "boundL": -7000, "boundR": 11000, "histL": -1000, "histR": 5000, "lPercent": 0.8402777777777778, "rPercent": 0, "rowCount": 1294.0277777777778 }, { "Result": 0 } ] }, { "End estimate range": { "RowCount": 0, "Type": "Range" } } ] }, { "Name": "a", "Result": 0 } ] }, { "github.com/pingcap/tidb/statistics.(*HistColl).GetRowCountByColumnRanges": [ { "ID": 2, "Ranges": [ "(400,403)" ] }, { "github.com/pingcap/tidb/statistics.(*Column).IsInvalid": { "EssentialLoaded": true, "InValidForCollPseudo": false, "IsInvalid": false, "NDV": 2001, "TotalCount": 3080 } }, { "Histogram NotNull Count": 3080, "Increase Factor": 1, "TopN total count": 1098 }, { "github.com/pingcap/tidb/statistics.(*Column).GetColumnRowCount": [ { "Start estimate range": { "CurrentRowCount": 0, "HighValueEncoded": "A4AAAAAAAAGT", "LowValueEncoded": "A4AAAAAAAAGQ", "Range": "(400,403)" } }, { "github.com/pingcap/tidb/statistics.(*Column).equalRowCount": [ { "Encoded": "A4AAAAAAAAGQ", "Value": "KindInt64 401" }, { "github.com/pingcap/tidb/statistics.(*TopN).QueryTopN": [ { "FindTopN idx": -1 }, { "Found": false, "Result": 0 } ] }, { "github.com/pingcap/tidb/statistics.(*CMSketch).queryHashValue": { "Origin Values": [ 1, 2, 2, 1, 1 ], "Result": 1, "Use default value": false, "Values": [ 2, 2, 2, 3, 3 ] } }, { "Error": null, "Result": 1 } ] }, { "End estimate range": { "RowCount": 1, "Type": "Small range in ver1 stats" } }, { "github.com/pingcap/tidb/statistics.(*Column).equalRowCount": [ { "Encoded": "A4AAAAAAAAGQ", "Value": "KindInt64 402" }, { "github.com/pingcap/tidb/statistics.(*TopN).QueryTopN": [ { "FindTopN idx": -1 }, { "Found": false, "Result": 0 } ] }, { "github.com/pingcap/tidb/statistics.(*CMSketch).queryHashValue": { "Origin Values": [ 1, 3, 2, 2, 2 ], "Result": 1, "Use default value": false, "Values": [ 2, 3, 3, 3, 4 ] } }, { "Error": null, "Result": 1 } ] }, { "End estimate range": { "RowCount": 1, "Type": "Small range in ver1 stats" } } ] }, { "Name": "b", "Result": 2 } ] }, { "github.com/pingcap/tidb/statistics.(*HistColl).GetRowCountByIndexRanges": [ { "ID": 1, "Ranges": [ "[-inf,-1500)" ] }, { "github.com/pingcap/tidb/statistics.(*Index).IsInvalid": { "CollPseudo": false, "IsInvalid": false, "NotAccurate": true, "TotalCount": 3080 } }, { "Histogram NotNull Count": 3080, "Increase Factor": 1, "TopN total count": 0 }, { "github.com/pingcap/tidb/statistics.(*HistColl).getIndexRowCount": [ { "Start estimate range": { "CurrentRowCount": 0, "HighValueEncoded": null, "LowValueEncoded": null, "Range": "[-inf,-1500)" } }, { "github.com/pingcap/tidb/statistics.(*Index).GetRowCount": [ { "Start estimate range": { "CurrentRowCount": 0, "HighValueEncoded": "A3////////ok", "LowValueEncoded": "AQ==", "Range": "[-inf,-1500)" } }, { "github.com/pingcap/tidb/statistics.(*Histogram).LessRowCountWithBktIdx": [ { "Locate value in buckets": { "BucketIdx": 0, "Exceed": false, "InBucket": false, "MatchLastValue": false, "Value": "KindBytes \\x01" } }, { "Related Buckets in Histogram": [ { "Count": -1, "Index": -1, "Repeat": -1 }, { "Count": 57, "Index": 0, "Repeat": 1 } ] }, { "Bucket idx": 0, "Result": 0 } ] }, { "github.com/pingcap/tidb/statistics.(*Histogram).LessRowCountWithBktIdx": [ { "Locate value in buckets": { "BucketIdx": 0, "Exceed": false, "InBucket": false, "MatchLastValue": false, "Value": "KindBytes \\x03\\x7f\\xff\\xff\\xff\\xff\\xff\\xfa$" } }, { "Related Buckets in Histogram": [ { "Count": -1, "Index": -1, "Repeat": -1 }, { "Count": 57, "Index": 0, "Repeat": 1 } ] }, { "Bucket idx": 0, "Result": 0 } ] }, { "github.com/pingcap/tidb/statistics.(*Histogram).outOfRangeRowCount": [ { "lDatum": "KindBytes \\x01", "modifyCount": 0, "rDatum": "KindBytes \\x03\\x7f\\xff\\xff\\xff\\xff\\xff\\xfa$" }, { "commonPrefix": 0, "lScalar": 72057594037927940, "rScalar": 252201579132747780, "unsigned": false }, { "boundL": 252201579132747740, "boundR": 252201579132747840, "histL": 252201579132747780, "histR": 252201579132747800, "lPercent": 1, "rPercent": 0, "rowCount": 1540 }, { "Result": 0 } ] }, { "End estimate range": { "RowCount": 0, "Type": "Range" } } ] }, { "End estimate range": { "RowCount": 0, "Type": "Range" } } ] }, { "Name": "iab", "Result": 0 } ] }, { "github.com/pingcap/tidb/statistics.(*HistColl).GetRowCountByIndexRanges": [ { "ID": 2, "Ranges": [ "(400,403)" ] }, { "github.com/pingcap/tidb/statistics.(*Index).IsInvalid": { "CollPseudo": false, "IsInvalid": false, "NotAccurate": true, "TotalCount": 3080 } }, { "Histogram NotNull Count": 3080, "Increase Factor": 1, "TopN total count": 0 }, { "github.com/pingcap/tidb/statistics.(*HistColl).getIndexRowCount": [ { "Start estimate range": { "CurrentRowCount": 0, "HighValueEncoded": null, "LowValueEncoded": null, "Range": "(400,403)" } }, { "github.com/pingcap/tidb/statistics.(*HistColl).getEqualCondSelectivity": [ { "github.com/pingcap/tidb/statistics.(*HistColl).crossValidationSelectivity": [ { "github.com/pingcap/tidb/statistics.(*Column).IsInvalid": { "EssentialLoaded": true, "InValidForCollPseudo": false, "IsInvalid": false, "NDV": 2001, "TotalCount": 3080 } }, { "github.com/pingcap/tidb/statistics.(*Column).GetColumnRowCount": [ { "Start estimate range": { "CurrentRowCount": 0, "HighValueEncoded": "A4AAAAAAAAGT", "LowValueEncoded": "A4AAAAAAAAGQ", "Range": "[400,403]" } }, { "github.com/pingcap/tidb/statistics.(*Column).equalRowCount": [ { "Encoded": "A4AAAAAAAAGQ", "Value": "KindInt64 400" }, { "github.com/pingcap/tidb/statistics.(*TopN).QueryTopN": [ { "FindTopN idx": 7 }, { "Found": true, "Result": 50 } ] }, { "Error": null, "Result": 50 } ] }, { "End estimate range": { "RowCount": 50, "Type": "Small range in ver1 stats" } }, { "github.com/pingcap/tidb/statistics.(*Column).equalRowCount": [ { "Encoded": "A4AAAAAAAAGQ", "Value": "KindInt64 401" }, { "github.com/pingcap/tidb/statistics.(*TopN).QueryTopN": [ { "FindTopN idx": -1 }, { "Found": false, "Result": 0 } ] }, { "github.com/pingcap/tidb/statistics.(*CMSketch).queryHashValue": { "Origin Values": [ 1, 2, 2, 1, 1 ], "Result": 1, "Use default value": false, "Values": [ 2, 2, 2, 3, 3 ] } }, { "Error": null, "Result": 1 } ] }, { "End estimate range": { "RowCount": 1, "Type": "Small range in ver1 stats" } }, { "github.com/pingcap/tidb/statistics.(*Column).equalRowCount": [ { "Encoded": "A4AAAAAAAAGQ", "Value": "KindInt64 402" }, { "github.com/pingcap/tidb/statistics.(*TopN).QueryTopN": [ { "FindTopN idx": -1 }, { "Found": false, "Result": 0 } ] }, { "github.com/pingcap/tidb/statistics.(*CMSketch).queryHashValue": { "Origin Values": [ 1, 3, 2, 2, 2 ], "Result": 1, "Use default value": false, "Values": [ 2, 3, 3, 3, 4 ] } }, { "Error": null, "Result": 1 } ] }, { "End estimate range": { "RowCount": 1, "Type": "Small range in ver1 stats" } }, { "github.com/pingcap/tidb/statistics.(*Column).equalRowCount": [ { "Encoded": "A4AAAAAAAAGQ", "Value": "KindInt64 403" }, { "github.com/pingcap/tidb/statistics.(*TopN).QueryTopN": [ { "FindTopN idx": -1 }, { "Found": false, "Result": 0 } ] }, { "github.com/pingcap/tidb/statistics.(*CMSketch).queryHashValue": { "Origin Values": [ 2, 2, 1, 2, 1 ], "Result": 1, "Use default value": false, "Values": [ 2, 2, 3, 3, 3 ] } }, { "Error": null, "Result": 1 } ] }, { "End estimate range": { "RowCount": 1, "Type": "Small range in ver1 stats" } } ] }, { "Index Name": "ib", "crossValidationSelectivity": 0.017207792207792207, "error": null, "minRowCount": 53 } ] }, { "github.com/pingcap/tidb/statistics.(*Index).QueryBytes": [ { "github.com/pingcap/tidb/statistics.(*CMSketch).queryHashValue": { "Origin Values": [ 1, 2, 2, 1, 3 ], "Result": 1, "Use default value": false, "Values": [ 1, 1, 2, 2, 3 ] } }, { "Result": 1 } ] }, { "Encoded": "A4AAAAAAAAGS", "Index Name": "ib", "Range": "(400,403)", "Result": 0.0003246753246753247, "UsedColLen": 1, "error": null } ] }, { "github.com/pingcap/tidb/statistics.(*HistColl).getEqualCondSelectivity": [ { "github.com/pingcap/tidb/statistics.(*HistColl).crossValidationSelectivity": [ { "github.com/pingcap/tidb/statistics.(*Column).IsInvalid": { "EssentialLoaded": true, "InValidForCollPseudo": false, "IsInvalid": false, "NDV": 2001, "TotalCount": 3080 } }, { "github.com/pingcap/tidb/statistics.(*Column).GetColumnRowCount": [ { "Start estimate range": { "CurrentRowCount": 0, "HighValueEncoded": "A4AAAAAAAAGT", "LowValueEncoded": "A4AAAAAAAAGQ", "Range": "[400,403]" } }, { "github.com/pingcap/tidb/statistics.(*Column).equalRowCount": [ { "Encoded": "A4AAAAAAAAGQ", "Value": "KindInt64 400" }, { "github.com/pingcap/tidb/statistics.(*TopN).QueryTopN": [ { "FindTopN idx": 7 }, { "Found": true, "Result": 50 } ] }, { "Error": null, "Result": 50 } ] }, { "End estimate range": { "RowCount": 50, "Type": "Small range in ver1 stats" } }, { "github.com/pingcap/tidb/statistics.(*Column).equalRowCount": [ { "Encoded": "A4AAAAAAAAGQ", "Value": "KindInt64 401" }, { "github.com/pingcap/tidb/statistics.(*TopN).QueryTopN": [ { "FindTopN idx": -1 }, { "Found": false, "Result": 0 } ] }, { "github.com/pingcap/tidb/statistics.(*CMSketch).queryHashValue": { "Origin Values": [ 1, 2, 2, 1, 1 ], "Result": 1, "Use default value": false, "Values": [ 2, 2, 2, 3, 3 ] } }, { "Error": null, "Result": 1 } ] }, { "End estimate range": { "RowCount": 1, "Type": "Small range in ver1 stats" } }, { "github.com/pingcap/tidb/statistics.(*Column).equalRowCount": [ { "Encoded": "A4AAAAAAAAGQ", "Value": "KindInt64 402" }, { "github.com/pingcap/tidb/statistics.(*TopN).QueryTopN": [ { "FindTopN idx": -1 }, { "Found": false, "Result": 0 } ] }, { "github.com/pingcap/tidb/statistics.(*CMSketch).queryHashValue": { "Origin Values": [ 1, 3, 2, 2, 2 ], "Result": 1, "Use default value": false, "Values": [ 2, 3, 3, 3, 4 ] } }, { "Error": null, "Result": 1 } ] }, { "End estimate range": { "RowCount": 1, "Type": "Small range in ver1 stats" } }, { "github.com/pingcap/tidb/statistics.(*Column).equalRowCount": [ { "Encoded": "A4AAAAAAAAGQ", "Value": "KindInt64 403" }, { "github.com/pingcap/tidb/statistics.(*TopN).QueryTopN": [ { "FindTopN idx": -1 }, { "Found": false, "Result": 0 } ] }, { "github.com/pingcap/tidb/statistics.(*CMSketch).queryHashValue": { "Origin Values": [ 2, 2, 1, 2, 1 ], "Result": 1, "Use default value": false, "Values": [ 2, 2, 3, 3, 3 ] } }, { "Error": null, "Result": 1 } ] }, { "End estimate range": { "RowCount": 1, "Type": "Small range in ver1 stats" } } ] }, { "Index Name": "ib", "crossValidationSelectivity": 0.017207792207792207, "error": null, "minRowCount": 53 } ] }, { "github.com/pingcap/tidb/statistics.(*Index).QueryBytes": [ { "github.com/pingcap/tidb/statistics.(*CMSketch).queryHashValue": { "Origin Values": [ 2, 3, 1, 3, 1 ], "Result": 1, "Use default value": false, "Values": [ 1, 1, 2, 3, 3 ] } }, { "Result": 1 } ] }, { "Encoded": "A4AAAAAAAAGS", "Index Name": "ib", "Range": "(400,403)", "Result": 0.0003246753246753247, "UsedColLen": 1, "error": null } ] }, { "End estimate range": { "RowCount": 2, "Type": "Range" } } ] }, { "Name": "ib", "Result": 2 } ] }, { "Expressions": [ "gt(test.t.b, 400)", "lt(test.t.b, 403)" ], "Selectivity": 0.0006493506493506494, "partial cover": false }, { "Expressions": [ "lt(test.t.a, -1500)" ], "Selectivity": 0, "partial cover": false }, { "Result": 0 } ] } ], "ResultForV2": [ { "github.com/pingcap/tidb/statistics.(*HistColl).Selectivity": [ { "Input Expressions": [ "lt(test.t.a, -1500)", "gt(test.t.b, 400)", "lt(test.t.b, 403)" ] }, { "github.com/pingcap/tidb/statistics.(*HistColl).GetRowCountByColumnRanges": [ { "ID": 1, "Ranges": [ "[-inf,-1500)" ] }, { "github.com/pingcap/tidb/statistics.(*Column).IsInvalid": { "EssentialLoaded": true, "InValidForCollPseudo": false, "IsInvalid": false, "NDV": 2000, "TotalCount": 2980 } }, { "Histogram NotNull Count": 1980, "Increase Factor": 1.0335570469798658, "TopN total count": 1000 }, { "github.com/pingcap/tidb/statistics.(*Column).GetColumnRowCount": [ { "Start estimate range": { "CurrentRowCount": 0, "HighValueEncoded": "A3////////ok", "LowValueEncoded": "AQ==", "Range": "[-inf,-1500)" } }, { "github.com/pingcap/tidb/statistics.(*Histogram).LessRowCountWithBktIdx": [ { "Locate value in buckets": { "BucketIdx": 0, "Exceed": false, "InBucket": false, "MatchLastValue": false, "Value": "KindMinNotNull " } }, { "Related Buckets in Histogram": [ { "Count": -1, "Index": -1, "Repeat": -1 }, { "Count": 8, "Index": 0, "Repeat": 1 } ] }, { "Bucket idx": 0, "Result": 0 } ] }, { "github.com/pingcap/tidb/statistics.(*Histogram).LessRowCountWithBktIdx": [ { "Locate value in buckets": { "BucketIdx": 0, "Exceed": false, "InBucket": false, "MatchLastValue": false, "Value": "KindInt64 -1500" } }, { "Related Buckets in Histogram": [ { "Count": -1, "Index": -1, "Repeat": -1 }, { "Count": 8, "Index": 0, "Repeat": 1 } ] }, { "Bucket idx": 0, "Result": 0 } ] }, { "github.com/pingcap/tidb/statistics.(*TopN).BetweenCount": { "Result": 0 } }, { "github.com/pingcap/tidb/statistics.(*Histogram).outOfRangeRowCount": [ { "lDatum": "KindMinNotNull ", "modifyCount": 100, "rDatum": "KindInt64 -1500" }, { "commonPrefix": 0, "lScalar": -1.7976931348623157e+308, "rScalar": -1500, "unsigned": false }, { "boundL": -2997, "boundR": 2997, "histL": -999, "histR": 999, "lPercent": 0.5613744375005636, "rPercent": 0, "rowCount": 555.760693125558 }, { "Result": 100 } ] }, { "End estimate range": { "RowCount": 100, "Type": "Range" } } ] }, { "Name": "a", "Result": 100 } ] }, { "github.com/pingcap/tidb/statistics.(*HistColl).GetRowCountByColumnRanges": [ { "ID": 2, "Ranges": [ "(400,403)" ] }, { "github.com/pingcap/tidb/statistics.(*Column).IsInvalid": { "EssentialLoaded": true, "InValidForCollPseudo": false, "IsInvalid": false, "NDV": 2000, "TotalCount": 2980 } }, { "Histogram NotNull Count": 1980, "Increase Factor": 1.0335570469798658, "TopN total count": 1000 }, { "github.com/pingcap/tidb/statistics.(*Column).GetColumnRowCount": [ { "Start estimate range": { "CurrentRowCount": 0, "HighValueEncoded": "A4AAAAAAAAGT", "LowValueEncoded": "A4AAAAAAAAGQ", "Range": "(400,403)" } }, { "github.com/pingcap/tidb/statistics.(*Histogram).LessRowCountWithBktIdx": [ { "Locate value in buckets": { "BucketIdx": 111, "Exceed": false, "InBucket": true, "MatchLastValue": false, "Value": "KindInt64 400" } }, { "Related Buckets in Histogram": [ { "Count": 888, "Index": 110, "Repeat": 1 }, { "Count": 896, "Index": 111, "Repeat": 1 } ] }, { "Bucket idx": 111, "Result": 890.625 } ] }, { "github.com/pingcap/tidb/statistics.(*Histogram).LessRowCountWithBktIdx": [ { "Locate value in buckets": { "BucketIdx": 111, "Exceed": false, "InBucket": true, "MatchLastValue": false, "Value": "KindInt64 403" } }, { "Related Buckets in Histogram": [ { "Count": 888, "Index": 110, "Repeat": 1 }, { "Count": 896, "Index": 111, "Repeat": 1 } ] }, { "Bucket idx": 111, "Result": 893.25 } ] }, { "github.com/pingcap/tidb/statistics.(*TopN).BetweenCount": [ { "Related TopN Range": { "Count": [ 50 ], "FirstEncoded": "A4AAAAAAAAGQ", "FirstIdx": 9, "LastEncoded": "A4AAAAAAAAGQ", "LastIdx": 9 } }, { "Result": 50 } ] }, { "github.com/pingcap/tidb/statistics.(*Column).equalRowCount": [ { "Encoded": "A4AAAAAAAAGQ", "Value": "KindInt64 400" }, { "github.com/pingcap/tidb/statistics.(*TopN).QueryTopN": [ { "FindTopN idx": 9 }, { "Found": true, "Result": 50 } ] }, { "Error": null, "Result": 50 } ] }, { "End estimate range": { "RowCount": 2.713087248322148, "Type": "Range" } } ] }, { "Name": "b", "Result": 2.713087248322148 } ] }, { "github.com/pingcap/tidb/statistics.(*HistColl).GetRowCountByIndexRanges": [ { "ID": 1, "Ranges": [ "[-inf,-1500)" ] }, { "github.com/pingcap/tidb/statistics.(*Index).IsInvalid": { "CollPseudo": false, "IsInvalid": false, "NotAccurate": true, "TotalCount": 2980 } }, { "Histogram NotNull Count": 1980, "Increase Factor": 1.0335570469798658, "TopN total count": 1000 }, { "github.com/pingcap/tidb/statistics.(*Index).GetRowCount": [ { "Start estimate range": { "CurrentRowCount": 0, "HighValueEncoded": "A3////////ok", "LowValueEncoded": "AQ==", "Range": "[-inf,-1500)" } }, { "github.com/pingcap/tidb/statistics.(*Histogram).LessRowCountWithBktIdx": [ { "Locate value in buckets": { "BucketIdx": 0, "Exceed": false, "InBucket": false, "MatchLastValue": false, "Value": "KindBytes \\x01" } }, { "Related Buckets in Histogram": [ { "Count": -1, "Index": -1, "Repeat": -1 }, { "Count": 8, "Index": 0, "Repeat": 1 } ] }, { "Bucket idx": 0, "Result": 0 } ] }, { "github.com/pingcap/tidb/statistics.(*Histogram).LessRowCountWithBktIdx": [ { "Locate value in buckets": { "BucketIdx": 0, "Exceed": false, "InBucket": false, "MatchLastValue": false, "Value": "KindBytes \\x03\\x7f\\xff\\xff\\xff\\xff\\xff\\xfa$" } }, { "Related Buckets in Histogram": [ { "Count": -1, "Index": -1, "Repeat": -1 }, { "Count": 8, "Index": 0, "Repeat": 1 } ] }, { "Bucket idx": 0, "Result": 0 } ] }, { "github.com/pingcap/tidb/statistics.(*TopN).BetweenCount": { "Result": 0 } }, { "github.com/pingcap/tidb/statistics.(*Histogram).outOfRangeRowCount": [ { "lDatum": "KindBytes \\x01", "modifyCount": 100, "rDatum": "KindBytes \\x03\\x7f\\xff\\xff\\xff\\xff\\xff\\xfa$" }, { "commonPrefix": 0, "lScalar": 72057594037927940, "rScalar": 252201579132747780, "unsigned": false }, { "Result": 0 } ] }, { "End estimate range": { "RowCount": 0, "Type": "Range" } } ] }, { "Name": "iab", "Result": 0 } ] }, { "github.com/pingcap/tidb/statistics.(*HistColl).GetRowCountByIndexRanges": [ { "ID": 2, "Ranges": [ "(400,403)" ] }, { "github.com/pingcap/tidb/statistics.(*Index).IsInvalid": { "CollPseudo": false, "IsInvalid": false, "NotAccurate": true, "TotalCount": 2980 } }, { "Histogram NotNull Count": 1980, "Increase Factor": 1.0335570469798658, "TopN total count": 1000 }, { "github.com/pingcap/tidb/statistics.(*Index).GetRowCount": [ { "Start estimate range": { "CurrentRowCount": 0, "HighValueEncoded": "A4AAAAAAAAGT", "LowValueEncoded": "A4AAAAAAAAGQ", "Range": "(400,403)" } }, { "github.com/pingcap/tidb/statistics.(*Histogram).LessRowCountWithBktIdx": [ { "Locate value in buckets": { "BucketIdx": 111, "Exceed": false, "InBucket": true, "MatchLastValue": false, "Value": "KindBytes \\x03\\x80\\x00\\x00\\x00\\x00\\x00\\x01\\x91" } }, { "Related Buckets in Histogram": [ { "Count": 888, "Index": 110, "Repeat": 1 }, { "Count": 896, "Index": 111, "Repeat": 1 } ] }, { "Bucket idx": 111, "Result": 891.5 } ] }, { "github.com/pingcap/tidb/statistics.(*Histogram).LessRowCountWithBktIdx": [ { "Locate value in buckets": { "BucketIdx": 111, "Exceed": false, "InBucket": true, "MatchLastValue": false, "Value": "KindBytes \\x03\\x80\\x00\\x00\\x00\\x00\\x00\\x01\\x93" } }, { "Related Buckets in Histogram": [ { "Count": 888, "Index": 110, "Repeat": 1 }, { "Count": 896, "Index": 111, "Repeat": 1 } ] }, { "Bucket idx": 111, "Result": 893.25 } ] }, { "github.com/pingcap/tidb/statistics.(*TopN).BetweenCount": { "Result": 0 } }, { "End estimate range": { "RowCount": 1.8087248322147653, "Type": "Range" } } ] }, { "Name": "ib", "Result": 1.8087248322147653 } ] }, { "Expressions": [ "gt(test.t.b, 400)", "lt(test.t.b, 403)" ], "Selectivity": 0.0005872483221476511, "partial cover": false }, { "Expressions": [ "lt(test.t.a, -1500)" ], "Selectivity": 0, "partial cover": false }, { "Result": 0 } ] } ] } ] } ]