"attached_condition": "v1.max_c > 400 or v1.max_c < 135"
},
"buffer_type": "flat",
"buffer_size": "256Kb",
"buffer_size": "238",
"join_type": "BNL",
"attached_condition": "v1.max_c > 400 and t2.a > v1.a or v1.max_c < 135 and t2.a < v1.a",
"materialized": {
...
...
@@ -359,7 +359,7 @@ EXPLAIN
"attached_condition": "v1.max_c > 300 or v1.max_c < 135"
},
"buffer_type": "flat",
"buffer_size": "256Kb",
"buffer_size": "238",
"join_type": "BNL",
"attached_condition": "v1.b = t2.b and v1.max_c > 300 and v1.avg_c > t2.d or v1.a = t2.a and v1.max_c < 135 and v1.max_c < t2.c",
"materialized": {
...
...
@@ -416,7 +416,7 @@ EXPLAIN
"attached_condition": "v1.a > 6"
},
"buffer_type": "flat",
"buffer_size": "256Kb",
"buffer_size": "238",
"join_type": "BNL",
"attached_condition": "t2.b > v1.b",
"materialized": {
...
...
@@ -483,7 +483,7 @@ EXPLAIN
"attached_condition": "v2.b > 25"
},
"buffer_type": "flat",
"buffer_size": "256Kb",
"buffer_size": "238",
"join_type": "BNL",
"attached_condition": "t2.a < v2.a",
"materialized": {
...
...
@@ -571,7 +571,7 @@ EXPLAIN
"attached_condition": "v1.a > 7 or v1.a < 2"
},
"buffer_type": "flat",
"buffer_size": "256Kb",
"buffer_size": "238",
"join_type": "BNL",
"attached_condition": "v1.a > 7 and t2.c < v1.max_c or v1.a < 2 and t2.b < v1.b",
"materialized": {
...
...
@@ -652,7 +652,7 @@ EXPLAIN
"attached_condition": "v2.a > 7 or v2.a > 5"
},
"buffer_type": "flat",
"buffer_size": "256Kb",
"buffer_size": "238",
"join_type": "BNL",
"attached_condition": "v2.a > 7 and t2.c < v2.max_c or v2.a > 5 and t2.b < v2.b",
"materialized": {
...
...
@@ -719,7 +719,7 @@ EXPLAIN
"attached_condition": "v1.a > 4 or v1.a < 2"
},
"buffer_type": "flat",
"buffer_size": "256Kb",
"buffer_size": "238",
"join_type": "BNL",
"attached_condition": "v1.a > 4 and v1.b > t2.b and v1.max_c = t2.d or v1.a < 2 and v1.max_c < t2.c and v1.max_c = t2.d",
"materialized": {
...
...
@@ -779,7 +779,7 @@ EXPLAIN
"attached_condition": "v1.a < 2 and v1.max_c > 400"
},
"buffer_type": "flat",
"buffer_size": "256Kb",
"buffer_size": "238",
"join_type": "BNL",
"attached_condition": "t2.b > v1.b",
"materialized": {
...
...
@@ -991,7 +991,7 @@ EXPLAIN
"attached_condition": "v1.a > 7 and v1.max_c > 300 or v1.a < 4 and v1.max_c < 500"
},
"buffer_type": "flat",
"buffer_size": "256Kb",
"buffer_size": "238",
"join_type": "BNL",
"attached_condition": "v1.a > 7 and v1.max_c > 300 and t2.c < v1.max_c or v1.a < 4 and v1.max_c < 500 and t2.b < v1.b",
"materialized": {
...
...
@@ -1080,7 +1080,7 @@ EXPLAIN
"attached_condition": "v1.a < 2 and v1.max_c > 120 or v1.a > 7"
},
"buffer_type": "flat",
"buffer_size": "256Kb",
"buffer_size": "238",
"join_type": "BNL",
"attached_condition": "v1.a < 2 and v1.max_c > 120 or v1.a > 7",
"materialized": {
...
...
@@ -1158,7 +1158,7 @@ EXPLAIN
"attached_condition": "v1.a < 2 and v1.max_c > 120 or v1.a > 7"
},
"buffer_type": "flat",
"buffer_size": "256Kb",
"buffer_size": "238",
"join_type": "BNL",
"attached_condition": "v1.b = t2.b and v1.a < 2 and v1.max_c > 120 or v1.a > 7",
"materialized": {
...
...
@@ -1225,7 +1225,7 @@ EXPLAIN
"attached_condition": "v1.a < 2 and v1.max_c < 200 or v1.a > 4"
},
"buffer_type": "flat",
"buffer_size": "256Kb",
"buffer_size": "238",
"join_type": "BNL",
"attached_condition": "v1.a < 2 and v1.max_c < 200 and t2.c > v1.max_c and v1.max_c = t2.d or v1.max_c = t2.c and v1.a > 4 and t2.c < 500 and t2.b < v1.b",
"materialized": {
...
...
@@ -1302,7 +1302,7 @@ EXPLAIN
"attached_condition": "v1.max_c > 400 or v1.max_c < 135"
},
"buffer_type": "flat",
"buffer_size": "256Kb",
"buffer_size": "238",
"join_type": "BNL",
"attached_condition": "v1.max_c > 400 and t2.a > v1.a or v1.max_c < 135 and t2.a < v1.a",
"materialized": {
...
...
@@ -1345,7 +1345,7 @@ EXPLAIN
"attached_condition": "v1.max_c > 400 or v1.max_c < 135"
},
"buffer_type": "flat",
"buffer_size": "256Kb",
"buffer_size": "238",
"join_type": "BNL",
"attached_condition": "v1.max_c > 400 and t2.a > v1.a or v1.max_c < 135 and t2.a < v1.a",
"materialized": {
...
...
@@ -1684,7 +1684,7 @@ EXPLAIN
"attached_condition": "v1.a = 3 and v1.b = 3"
},
"buffer_type": "flat",
"buffer_size": "256Kb",
"buffer_size": "238",
"join_type": "BNL",
"materialized": {
"query_block": {
...
...
@@ -1734,7 +1734,7 @@ EXPLAIN
"attached_condition": "v1.a = 1 and v1.b = 21"
},
"buffer_type": "flat",
"buffer_size": "256Kb",
"buffer_size": "238",
"join_type": "BNL",
"materialized": {
"query_block": {
...
...
@@ -1807,7 +1807,7 @@ EXPLAIN
"filtered": 100
},
"buffer_type": "flat",
"buffer_size": "256Kb",
"buffer_size": "220",
"join_type": "BNL",
"attached_condition": "t.b = v.b or v.max_c > 20"
}
...
...
@@ -1931,7 +1931,7 @@ EXPLAIN
"filtered": 100
},
"buffer_type": "flat",
"buffer_size": "256Kb",
"buffer_size": "238",
"join_type": "BNL",
"attached_condition": "v1.a = t2.a and t2.a < 4 or v1.max_c = t2.c and t2.c > 150",
"materialized": {
...
...
@@ -2061,7 +2061,7 @@ EXPLAIN
"attached_condition": "v1.a = 8 and v1.max_c = 404"
},
"buffer_type": "flat",
"buffer_size": "256Kb",
"buffer_size": "238",
"join_type": "BNL",
"materialized": {
"query_block": {
...
...
@@ -2359,7 +2359,7 @@ EXPLAIN
"filtered": 100
},
"buffer_type": "flat",
"buffer_size": "256Kb",
"buffer_size": "162",
"join_type": "BNL"
}
}
...
...
@@ -2471,7 +2471,7 @@ EXPLAIN
"filtered": 100
},
"buffer_type": "flat",
"buffer_size": "256Kb",
"buffer_size": "238",
"join_type": "BNL",
"materialized": {
"query_block": {
...
...
@@ -2598,7 +2598,7 @@ EXPLAIN
"filtered": 100
},
"buffer_type": "flat",
"buffer_size": "256Kb",
"buffer_size": "238",
"join_type": "BNL",
"attached_condition": "v1.a = t2.a or v1.b = t2.b and (v1.a = 1 or v1.a = 6)",
"materialized": {
...
...
@@ -2693,7 +2693,7 @@ EXPLAIN
"filtered": 100
},
"buffer_type": "flat",
"buffer_size": "256Kb",
"buffer_size": "238",
"join_type": "BNL",
"attached_condition": "v1.a = 1 or v1.b = 21 or t2.a = 2",
"materialized": {
...
...
@@ -2761,7 +2761,7 @@ EXPLAIN
"filtered": 100
},
"buffer_type": "flat",
"buffer_size": "256Kb",
"buffer_size": "238",
"join_type": "BNL",
"attached_condition": "v1.a < t2.a or t2.a < 11",
"materialized": {
...
...
@@ -2943,7 +2943,7 @@ EXPLAIN
"filtered": 100
},
"buffer_type": "flat",
"buffer_size": "256Kb",
"buffer_size": "238",
"join_type": "BNL",
"attached_condition": "v1.b is not null",
"materialized": {
...
...
@@ -3038,7 +3038,7 @@ EXPLAIN
"filtered": 100
},
"buffer_type": "flat",
"buffer_size": "256Kb",
"buffer_size": "238",
"join_type": "BNL",
"attached_condition": "v1.a = t2.a or t2.c < 115",
"materialized": {
...
...
@@ -3067,7 +3067,7 @@ EXPLAIN
"filtered": 100
},
"buffer_type": "incremental",
"buffer_size": "256Kb",
"buffer_size": "4Kb",
"join_type": "BNL",
"attached_condition": "v1.a = t2.a and v2.a = t2.a or v2.b > 13 and t2.c < 115",
"materialized": {
...
...
@@ -3138,7 +3138,7 @@ EXPLAIN
"attached_condition": "v1.max_c < 300"
},
"buffer_type": "flat",
"buffer_size": "256Kb",
"buffer_size": "238",
"join_type": "BNL",
"materialized": {
"query_block": {
...
...
@@ -3167,7 +3167,7 @@ EXPLAIN
"attached_condition": "v2.b < 50 or v2.b = 19"
},
"buffer_type": "incremental",
"buffer_size": "256Kb",
"buffer_size": "4Kb",
"join_type": "BNL",
"attached_condition": "(v2.a = v1.a or v1.a = t2.a) and (v2.b < 50 or v2.b = 19)",
"materialized": {
...
...
@@ -3317,7 +3317,7 @@ EXPLAIN
"attached_condition": "v1.a = 1 and v1.b > 10"
},
"buffer_type": "flat",
"buffer_size": "256Kb",
"buffer_size": "238",
"join_type": "BNL",
"attached_condition": "v1.b is not null",
"materialized": {
...
...
@@ -3435,7 +3435,7 @@ EXPLAIN
"attached_condition": "t.a = 'b'"
},
"buffer_type": "flat",
"buffer_size": "256Kb",
"buffer_size": "220",
"join_type": "BNL"
}
}
...
...
@@ -3544,7 +3544,7 @@ EXPLAIN
"attached_condition": "v2.max_c > 300"
},
"buffer_type": "flat",
"buffer_size": "256Kb",
"buffer_size": "715",
"join_type": "BNL",
"materialized": {
"query_block": {
...
...
@@ -3574,7 +3574,7 @@ EXPLAIN
"attached_condition": "v1.max_c < 500"
},
"buffer_type": "incremental",
"buffer_size": "256Kb",
"buffer_size": "9Kb",
"join_type": "BNL",
"attached_condition": "v1.a = v2.a or v1.a = t2.a",
"materialized": {
...
...
@@ -3790,7 +3790,7 @@ EXPLAIN
"attached_condition": "v1.avg_c < 400 or v1.a > 1"
},
"buffer_type": "flat",
"buffer_size": "256Kb",
"buffer_size": "238",
"join_type": "BNL",
"attached_condition": "(v1.avg_c < 400 or v1.a > 1) and v1.a is not null and v1.b is not null",
"materialized": {
...
...
@@ -3935,7 +3935,7 @@ EXPLAIN
"attached_condition": "(v1.a = 1 or v1.max_c < 300) and v1.b > 25"
},
"buffer_type": "flat",
"buffer_size": "256Kb",
"buffer_size": "238",
"join_type": "BNL",
"attached_condition": "v1.a = 1 or v1.max_c < 300",
"materialized": {
...
...
@@ -4128,7 +4128,7 @@ EXPLAIN
"attached_condition": "v1.max_c > 100 and v1.a > 7"
},
"buffer_type": "flat",
"buffer_size": "256Kb",
"buffer_size": "238",
"join_type": "BNL",
"materialized": {
"query_block": {
...
...
@@ -4229,7 +4229,7 @@ EXPLAIN
"attached_condition": "v1.b = 19 and v1.a < 5"
},
"buffer_type": "flat",
"buffer_size": "256Kb",
"buffer_size": "238",
"join_type": "BNL",
"materialized": {
"query_block": {
...
...
@@ -4271,7 +4271,7 @@ EXPLAIN
"attached_condition": "v1.max_c > 400 or v1.avg_c > 270"
},
"buffer_type": "flat",
"buffer_size": "256Kb",
"buffer_size": "238",
"join_type": "BNL",
"attached_condition": "(v1.max_c > 400 or v1.avg_c > 270) and v1.a < t2.a",
"materialized": {
...
...
@@ -4383,7 +4383,7 @@ EXPLAIN
"attached_condition": "v1.a = 1 or v1.a = 6"
},
"buffer_type": "flat",
"buffer_size": "256Kb",
"buffer_size": "238",
"join_type": "BNL",
"attached_condition": "(v1.a = t2.a or v1.b = t2.b) and (v1.a = 1 or v1.a = 6)",
"materialized": {
...
...
@@ -4426,7 +4426,7 @@ EXPLAIN
"attached_condition": "v1.a > 3 and v1.b > 27 or v1.max_c > 550"
},
"buffer_type": "flat",
"buffer_size": "256Kb",
"buffer_size": "238",
"join_type": "BNL",
"attached_condition": "v1.a > 3 and v1.b > 27 or v1.max_c > 550",
"materialized": {
...
...
@@ -4540,7 +4540,7 @@ EXPLAIN
"attached_condition": "v1.a = 1 and (v1.max_c < 500 or v1.avg_c > 500)"
},
"buffer_type": "flat",
"buffer_size": "256Kb",
"buffer_size": "238",
"join_type": "BNL",
"attached_condition": "v1.max_c < 500 or v1.avg_c > 500",
"materialized": {
...
...
@@ -4584,7 +4584,7 @@ EXPLAIN
"attached_condition": "v2.b > 10"
},
"buffer_type": "flat",
"buffer_size": "256Kb",
"buffer_size": "238",
"join_type": "BNL",
"attached_condition": "v2.a < t2.b or v2.max_c > 200",
"materialized": {
...
...
@@ -4706,7 +4706,7 @@ EXPLAIN
"attached_condition": "v_union.a < 3 and v_union.c > 100"
},
"buffer_type": "flat",
"buffer_size": "256Kb",
"buffer_size": "238",
"join_type": "BNL",
"materialized": {
"query_block": {
...
...
@@ -4814,7 +4814,7 @@ EXPLAIN
"attached_condition": "(v_union.a < 2 or v_union.c > 800) and v_union.b > 12"
},
"buffer_type": "flat",
"buffer_size": "256Kb",
"buffer_size": "238",
"join_type": "BNL",
"attached_condition": "v_union.a < 2 or v_union.c > 800",
"materialized": {
...
...
@@ -4911,7 +4911,7 @@ EXPLAIN
"attached_condition": "v_union.a = 1 and v_union.c < 200"
},
"buffer_type": "flat",
"buffer_size": "256Kb",
"buffer_size": "238",
"join_type": "BNL",
"materialized": {
"query_block": {
...
...
@@ -5078,7 +5078,7 @@ EXPLAIN
"attached_condition": "v1.a = 1"
},
"buffer_type": "flat",
"buffer_size": "256Kb",
"buffer_size": "238",
"join_type": "BNL",
"materialized": {
"query_block": {
...
...
@@ -5108,7 +5108,7 @@ EXPLAIN
"attached_condition": "v_union.a = 1"
},
"buffer_type": "incremental",
"buffer_size": "256Kb",
"buffer_size": "4Kb",
"join_type": "BNL",
"attached_condition": "v_union.c > 800 or v1.max_c > 200",
"materialized": {
...
...
@@ -5923,7 +5923,7 @@ EXPLAIN
"attached_condition": "v1.a > 5 and v1.b > 12"
},
"buffer_type": "flat",
"buffer_size": "256Kb",
"buffer_size": "333",
"join_type": "BNL",
"materialized": {
"query_block": {
...
...
@@ -6306,7 +6306,7 @@ EXPLAIN
"attached_condition": "v4.b > 10 and v4.a > 1 or v4.b < 20"
},
"buffer_type": "flat",
"buffer_size": "256Kb",
"buffer_size": "238",
"join_type": "BNL",
"attached_condition": "(v4.b > 10 and v4.a > 1 or v4.b < 20) and v4.a is not null",
"materialized": {
...
...
@@ -6451,7 +6451,7 @@ EXPLAIN
"filtered": 100
},
"buffer_type": "flat",
"buffer_size": "256Kb",
"buffer_size": "333",
"join_type": "BNL",
"materialized": {
"query_block": {
...
...
@@ -6971,7 +6971,7 @@ EXPLAIN
"filtered": 100
},
"buffer_type": "flat",
"buffer_size": "256Kb",
"buffer_size": "715",
"join_type": "BNL",
"materialized": {
"query_block": {
...
...
@@ -7766,7 +7766,7 @@ EXPLAIN
"attached_condition": "v2.pk > 2"
},
"buffer_type": "flat",
"buffer_size": "256Kb",
"buffer_size": "119",
"join_type": "BNL",
"materialized": {
"query_block": {
...
...
@@ -8763,7 +8763,7 @@ EXPLAIN
"attached_condition": "v2.i2 = 1"
},
"buffer_type": "flat",
"buffer_size": "256Kb",
"buffer_size": "65",
"join_type": "BNL",
"materialized": {
"query_block": {
...
...
@@ -8879,7 +8879,7 @@ EXPLAIN
"filtered": 100
},
"buffer_type": "flat",
"buffer_size": "256Kb",
"buffer_size": "163",
"join_type": "BNL",
"attached_condition": "t1.id2 = vc.id2"
}
...
...
@@ -8952,7 +8952,7 @@ EXPLAIN
"attached_condition": "v1.a = 1 and v1.b = 1 and v1.max_c > 30"
},
"buffer_type": "flat",
"buffer_size": "256Kb",
"buffer_size": "173",
"join_type": "BNL",
"materialized": {
"query_block": {
...
...
@@ -9027,7 +9027,7 @@ EXPLAIN
"attached_condition": "v1.a = 1 and v1.b = 1 and v1.d = 1 and v1.max_c > 30"
},
"buffer_type": "flat",
"buffer_size": "256Kb",
"buffer_size": "173",
"join_type": "BNL",
"materialized": {
"query_block": {
...
...
@@ -9759,7 +9759,7 @@ EXPLAIN
"filtered": 100
},
"buffer_type": "flat",
"buffer_size": "256Kb",
"buffer_size": "65",
"join_type": "BNL",
"attached_condition": "t1.a = dt1.a"
}
...
...
@@ -9818,7 +9818,7 @@ EXPLAIN
"filtered": 100
},
"buffer_type": "flat",
"buffer_size": "256Kb",
"buffer_size": "119",
"join_type": "BNL",
"attached_condition": "t1.a = dt.a"
}
...
...
@@ -10314,7 +10314,7 @@ EXPLAIN
"attached_condition": "t1.f is not null"
},
"buffer_type": "flat",
"buffer_size": "256Kb",
"buffer_size": "64",
"join_type": "BNL"
}
}
...
...
@@ -10489,7 +10489,7 @@ EXPLAIN
"filtered": 100
},
"buffer_type": "flat",
"buffer_size": "256Kb",
"buffer_size": "65",
"join_type": "BNL",
"attached_condition": "t1.f2 = t.f2"
}
...
...
@@ -10648,7 +10648,7 @@ EXPLAIN
"attached_condition": "v1.a = 8"
},
"buffer_type": "flat",
"buffer_size": "256Kb",
"buffer_size": "173",
"join_type": "BNL",
"materialized": {
"query_block": {
...
...
@@ -10736,7 +10736,7 @@ EXPLAIN
"attached_condition": "v1.a = 8"
},
"buffer_type": "flat",
"buffer_size": "256Kb",
"buffer_size": "173",
"join_type": "BNL",
"materialized": {
"query_block": {
...
...
@@ -11226,7 +11226,7 @@ EXPLAIN
"attached_condition": "v1.a > 3 or v1.a = 1 and v1.c < 110"
},
"buffer_type": "flat",
"buffer_size": "256Kb",
"buffer_size": "173",
"join_type": "BNL",
"attached_condition": "v1.c = t2.c and v1.a > 3 and t2.c > 110 or v1.a = 1 and v1.c < 110",
"materialized": {
...
...
@@ -11567,7 +11567,7 @@ EXPLAIN
"attached_condition": "v1.a = 6"
},
"buffer_type": "flat",
"buffer_size": "256Kb",
"buffer_size": "173",
"join_type": "BNL",
"materialized": {
"query_block": {
...
...
@@ -11657,7 +11657,7 @@ EXPLAIN
"attached_condition": "v1.a = 6"
},
"buffer_type": "flat",
"buffer_size": "256Kb",
"buffer_size": "173",
"join_type": "BNL",
"materialized": {
"query_block": {
...
...
@@ -12151,7 +12151,7 @@ EXPLAIN
"attached_condition": "v1.a > 1 or v1.a = 1 and v1.c > 500"
},
"buffer_type": "flat",
"buffer_size": "256Kb",
"buffer_size": "173",
"join_type": "BNL",
"attached_condition": "v1.c = t2.c and v1.a > 1 and t2.c < 500 or v1.a = 1 and v1.c > 500",
"materialized": {
...
...
@@ -14011,7 +14011,7 @@ EXPLAIN
"filtered": 100
},
"buffer_type": "flat",
"buffer_size": "256Kb",
"buffer_size": "173",
"join_type": "BNL",
"attached_condition": "t2.b = v1.b"
}
...
...
@@ -14107,7 +14107,7 @@ EXPLAIN
"filtered": 100
},
"buffer_type": "flat",
"buffer_size": "256Kb",
"buffer_size": "173",
"join_type": "BNL",
"attached_condition": "t2.b = v1.b"
}
...
...
@@ -16414,7 +16414,7 @@ EXPLAIN
"filtered": 100
},
"buffer_type": "flat",
"buffer_size": "256Kb",
"buffer_size": "65",
"join_type": "BNL",
"attached_condition": "t2.i = t1.i and t2.i = t1.i"
# MDEV-18551: New defaults for eq_range_index_dive_limit
#
create table ten(a int);
insert into ten values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
create table t1(a int, key(a));
insert into t1 select A.a + B.a*10 + C.a*100 from ten A, ten B,ten C;
insert into t1 select 1 from ten A, ten B,ten C;
create table t2(a int, key(a));
insert into t2 select A.a + B.a*10 + C.a*100 from ten A, ten B,ten C where A.a + B.a*10 + C.a*100 < 199;
# expected type=range, rows=1487 , reason=using index dives
analyze SELECT * FROM t1 where a in (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198);
id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
1 SIMPLE t1 range a a 5 NULL 1487 1199.00 100.00 100.00 Using where; Using index
insert into t2 values (200),(201);
# expected type=range, rows=201 , reason=using index statistics
analyze SELECT * FROM t1 where a in (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,200,201);
id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
1 SIMPLE t1 range a a 5 NULL 201 1201.00 100.00 100.00 Using where; Using index
drop table t1,ten,t2;
#
# End of 10.2 tests
#
set global innodb_stats_persistent= @innodb_stats_persistent_save;
# MDEV-18551: New defaults for eq_range_index_dive_limit
#
create table ten(a int);
insert into ten values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
create table t1(a int, key(a));
insert into t1 select A.a + B.a*10 + C.a*100 from ten A, ten B,ten C;
insert into t1 select 1 from ten A, ten B,ten C;
create table t2(a int, key(a));
insert into t2 select A.a + B.a*10 + C.a*100 from ten A, ten B,ten C where A.a + B.a*10 + C.a*100 < 199;
# expected type=range, rows=1487 , reason=using index dives
analyze SELECT * FROM t1 where a in (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198);
id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
1 SIMPLE t1 range a a 5 NULL 1487 1199.00 100.00 100.00 Using where; Using index
insert into t2 values (200),(201);
# expected type=range, rows=201 , reason=using index statistics
analyze SELECT * FROM t1 where a in (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,200,201);
id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
1 SIMPLE t1 range a a 5 NULL 201 1201.00 100.00 100.00 Using where; Using index
drop table t1,ten,t2;
#
# End of 10.2 tests
#
set global innodb_stats_persistent= @innodb_stats_persistent_save;
@@ -1085,7 +1085,7 @@ EXPLAIN SELECT Name, Country, Population FROM City WHERE
(Name='Samara' AND Country='RUS') OR
(Name='Seattle' AND Country='USA');
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE City range Country,CountryPopulation,CountryName,CityName CityName 35 NULL 27 Using index condition; Using where
1 SIMPLE City index_merge Country,CountryPopulation,CountryName,CityName CountryName,CityName 38,35 NULL 27 Using sort_union(CountryName,CityName); Using where
SELECT Name, Country, Population FROM City WHERE
(Name='Manila' AND Country='PHL') OR
(Name='Addis Abeba' AND Country='ETH') OR
...
...
@@ -1116,32 +1116,32 @@ SELECT Name, Country, Population FROM City WHERE
(Name='Seattle' AND Country='USA');
Name Country Population
Addis Abeba ETH 2495000
Ankara TUR 3038159
Bangalore IND 2660088
Basel CHE 166700
Caracas VEN 1975294
Dakar SEN 785071
Delhi IND 7206704
Dresden DEU 476668
Manila PHL 1581082
Jakarta IDN 9604900
Delhi IND 7206704
Bangalore IND 2660088
Teheran IRN 6758845
Roma ITA 2643581
Venezia ITA 277305
Tokyo JPN 7980230
Toronto CAN 688275
Vancouver CAN 514008
Peking CHN 7472000
Seoul KOR 9981619
Kaunas LTU 412639
Rabat MAR 623457
Tijuana MEX 1212232
Lagos NGA 1518000
Lugansk UKR 469000
Manila PHL 1581082
Paris FRA 2125246
Peking CHN 7472000
Dresden DEU 476668
Dakar SEN 785071
Basel CHE 166700
Praha CZE 1181126
Rabat MAR 623457
Roma ITA 2643581
Ankara TUR 3038159
Lugansk UKR 469000
Caracas VEN 1975294
Samara RUS 1156100
Seattle USA 563374
Seoul KOR 9981619
Teheran IRN 6758845
Tijuana MEX 1212232
Tokyo JPN 7980230
Toronto CAN 688275
Vancouver CAN 514008
Venezia ITA 277305
set optimizer_switch='index_merge=off';
EXPLAIN SELECT Name, Country, Population FROM City WHERE
(Name='Manila' AND Country='PHL') OR
...
...
@@ -1172,7 +1172,7 @@ EXPLAIN SELECT Name, Country, Population FROM City WHERE
(Name='Samara' AND Country='RUS') OR
(Name='Seattle' AND Country='USA');
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE City range Country,CountryPopulation,CountryName,CityName CityName 35 NULL 27 Using index condition; Using where
1 SIMPLE City range Country,CountryPopulation,CountryName,CityName CityName 35 NULL 28 Using index condition; Using where
SELECT Name, Country, Population FROM City WHERE
(Name='Manila' AND Country='PHL') OR
(Name='Addis Abeba' AND Country='ETH') OR
...
...
@@ -1906,23 +1906,23 @@ Country='NOR' AND Name IN ('Oslo', 'Bergen') OR
Country='ITA' AND Name IN ('Napoli', 'Venezia');
ID Name Country Population
175 Antwerpen BEL 446525
2808 Bergen NOR 230948
176 Gent BEL 224180
3068 Berlin DEU 3386667
3087 Bonn DEU 301048
2918 Braga PRT 90535
176 Gent BEL 224180
3242 Lahti FIN 96921
3580 Moscow RUS 8389200
2974 Paris FRA 2125246
1466 Napoli ITA 1002619
1474 Venezia ITA 277305
2808 Bergen NOR 230948
2807 Oslo NOR 508726
2974 Paris FRA 2125246
2928 Warszawa POL 1615369
2931 Wroclaw POL 636765
2918 Braga PRT 90535
2915 Porto PRT 273060
3580 Moscow RUS 8389200
3581 St Petersburg RUS 4694000
3048 Stockholm SWE 750348
3051 Uppsala SWE 189569
1474 Venezia ITA 277305
2928 Warszawa POL 1615369
2931 Wroclaw POL 636765
explain select * from City
where
Country='FIN' AND Name IN ('Lahti','Imatra') OR
...
...
@@ -1936,7 +1936,7 @@ Country='POL' AND Name IN ('Warszawa', 'Wroclaw') OR
Country='NOR' AND Name IN ('Oslo', 'Bergen') OR
Country='ITA' AND Name IN ('Napoli', 'Venezia');
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE City range CountryName,Name Name 35 NULL 20 Using index condition; Using where
1 SIMPLE City range CountryName,Name CountryName 38 NULL 20 Using index condition; Using where
DROP DATABASE world;
set session optimizer_switch='index_merge_sort_intersection=default';
set global innodb_stats_persistent= @innodb_stats_persistent_save;
VARIABLE_COMMENT Percentage of rows from the table ANALYZE TABLE will sample to collect table statistics. Set to 0 to let MariaDB decide what percentage of rows to sample.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 100
NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME AUTOCOMMIT
SESSION_VALUE ON
GLOBAL_VALUE ON
...
...
@@ -881,10 +895,10 @@ ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT NULL
VARIABLE_NAME EQ_RANGE_INDEX_DIVE_LIMIT
SESSION_VALUE 10
GLOBAL_VALUE 10
SESSION_VALUE 200
GLOBAL_VALUE 200
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 10
DEFAULT_VALUE 200
VARIABLE_SCOPE SESSION
VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT The optimizer will use existing index statistics instead of doing index dives for equality ranges if the number of equality ranges for the index is larger than or equal to this number. If set to 0, index dives are always used.
VARIABLE_COMMENT Percentage of rows from the table ANALYZE TABLE will sample to collect table statistics. Set to 0 to let MariaDB decide what percentage of rows to sample.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 100
NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME AUTOCOMMIT
SESSION_VALUE ON
GLOBAL_VALUE ON
...
...
@@ -895,10 +909,10 @@ ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT NULL
VARIABLE_NAME EQ_RANGE_INDEX_DIVE_LIMIT
SESSION_VALUE 10
GLOBAL_VALUE 10
SESSION_VALUE 200
GLOBAL_VALUE 200
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 10
DEFAULT_VALUE 200
VARIABLE_SCOPE SESSION
VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT The optimizer will use existing index statistics instead of doing index dives for equality ranges if the number of equality ranges for the index is larger than or equal to this number. If set to 0, index dives are always used.