summaryrefslogtreecommitdiff
path: root/mysql-test/main/opt_trace.result
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2020-06-05 20:36:43 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2020-06-05 20:36:43 +0300
commit6877ef9a7c9c7ee55d67e4baaf4e8f7b874c9f89 (patch)
treeade4c0b2e50538438e70dc49581541de94098625 /mysql-test/main/opt_trace.result
parent374f94c5a749ec6af83824c1f55f0f49029a9714 (diff)
parent68d9d512e933a1d40670add50f205e5266bc5507 (diff)
downloadmariadb-git-6877ef9a7c9c7ee55d67e4baaf4e8f7b874c9f89.tar.gz
Merge 10.4 into 10.5
Diffstat (limited to 'mysql-test/main/opt_trace.result')
-rw-r--r--mysql-test/main/opt_trace.result173
1 files changed, 173 insertions, 0 deletions
diff --git a/mysql-test/main/opt_trace.result b/mysql-test/main/opt_trace.result
index 2e4cfb9acb7..ad7bce44445 100644
--- a/mysql-test/main/opt_trace.result
+++ b/mysql-test/main/opt_trace.result
@@ -441,6 +441,7 @@ select * from v2 {
},
"rows_for_plan": 1,
"cost_for_plan": 2.404394531,
+ "cost_for_sorting": 1,
"estimated_join_cardinality": 1
}
]
@@ -765,6 +766,7 @@ explain select * from v1 {
},
"rows_for_plan": 10,
"cost_for_plan": 4.021972656,
+ "cost_for_sorting": 10,
"estimated_join_cardinality": 10
}
]
@@ -1452,6 +1454,7 @@ EXPLAIN SELECT MIN(d) FROM t1 where b=2 and c=3 group by a {
},
"rows_for_plan": 8,
"cost_for_plan": 3.8,
+ "cost_for_sorting": 8,
"estimated_join_cardinality": 8
}
]
@@ -1645,6 +1648,7 @@ EXPLAIN SELECT id,MIN(a),MAX(a) FROM t1 WHERE a>=20010104e0 GROUP BY id {
},
"rows_for_plan": 9,
"cost_for_plan": 4.15,
+ "cost_for_sorting": 9,
"estimated_join_cardinality": 9
}
]
@@ -1827,6 +1831,7 @@ EXPLAIN SELECT * FROM t1 WHERE a = 20010104e0 GROUP BY id {
},
"rows_for_plan": 9,
"cost_for_plan": 4.15,
+ "cost_for_sorting": 9,
"estimated_join_cardinality": 9
}
]
@@ -8258,6 +8263,174 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.range_scan_alternatives'))
]
]
drop table t1;
+#
+# MDEV-21626: Optimizer misses the details about the picked join order
+#
+CREATE TABLE t1(a INT, b INT, key(a));
+INSERT INTO t1 SELECT seq, seq from seq_1_to_10;
+CREATE TABLE t2(a INT, b INT, key(a));
+INSERT INTO t2 SELECT seq, seq from seq_1_to_100;
+SET OPTIMIZER_TRACE=1;
+EXPLAIN SELECT * FROM t1, t2 WHERE t1.a=t2.a ORDER BY t2.b;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL a NULL NULL NULL 10 Using where; Using temporary; Using filesort
+1 SIMPLE t2 ref a a 5 test.t1.a 1
+select JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
+JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans'))
+[
+
+ [
+
+ {
+ "plan_prefix":
+ [
+ ],
+ "table": "t1",
+ "best_access_path":
+ {
+ "considered_access_paths":
+ [
+
+ {
+ "access_type": "scan",
+ "resulting_rows": 10,
+ "cost": 2.021972656,
+ "chosen": true
+ }
+ ],
+ "chosen_access_method":
+ {
+ "type": "scan",
+ "records": 10,
+ "cost": 2.021972656,
+ "uses_join_buffering": false
+ }
+ },
+ "rows_for_plan": 10,
+ "cost_for_plan": 4.021972656,
+ "rest_of_plan":
+ [
+
+ {
+ "plan_prefix":
+ [
+ "t1"
+ ],
+ "table": "t2",
+ "best_access_path":
+ {
+ "considered_access_paths":
+ [
+
+ {
+ "access_type": "ref",
+ "index": "a",
+ "used_range_estimates": false,
+ "cause": "not available",
+ "rows": 1,
+ "cost": 20.00585794,
+ "chosen": true
+ },
+
+ {
+ "access_type": "scan",
+ "resulting_rows": 100,
+ "cost": 2.219726562,
+ "chosen": false
+ }
+ ],
+ "chosen_access_method":
+ {
+ "type": "ref",
+ "records": 1,
+ "cost": 20.00585794,
+ "uses_join_buffering": false
+ }
+ },
+ "rows_for_plan": 10,
+ "cost_for_plan": 26.0278306,
+ "cost_for_sorting": 10,
+ "estimated_join_cardinality": 10
+ }
+ ]
+ },
+
+ {
+ "plan_prefix":
+ [
+ ],
+ "table": "t2",
+ "best_access_path":
+ {
+ "considered_access_paths":
+ [
+
+ {
+ "access_type": "scan",
+ "resulting_rows": 100,
+ "cost": 2.219726562,
+ "chosen": true,
+ "use_tmp_table": true
+ }
+ ],
+ "chosen_access_method":
+ {
+ "type": "scan",
+ "records": 100,
+ "cost": 2.219726562,
+ "uses_join_buffering": false
+ }
+ },
+ "rows_for_plan": 100,
+ "cost_for_plan": 22.21972656,
+ "rest_of_plan":
+ [
+
+ {
+ "plan_prefix":
+ [
+ "t2"
+ ],
+ "table": "t1",
+ "best_access_path":
+ {
+ "considered_access_paths":
+ [
+
+ {
+ "access_type": "ref",
+ "index": "a",
+ "used_range_estimates": false,
+ "cause": "not available",
+ "rows": 1,
+ "cost": 200.0585794,
+ "chosen": true
+ },
+
+ {
+ "access_type": "scan",
+ "resulting_rows": 10,
+ "cost": 2.021972656,
+ "chosen": true
+ }
+ ],
+ "chosen_access_method":
+ {
+ "type": "scan",
+ "records": 10,
+ "cost": 2.021972656,
+ "uses_join_buffering": true
+ }
+ },
+ "rows_for_plan": 1000,
+ "cost_for_plan": 224.2416992,
+ "pruned_by_cost": true
+ }
+ ]
+ }
+ ]
+]
+DROP TABLE t1,t2;
# End of 10.4 tests
#
# Test many rows to see output of big cost numbers