Description:
Hello mysql team:
Here is a suggestion for query plan display of accesspath `unqualified_count`.
How to repeat:
Can be repeated in MySQL 8.4.0. Seems t2, t3 should be added in query plan.
create table t1(c1 int);
create table t2 like t1;
create table t3 like t2;
explain format=tree select count(*) from t1,t2,t3;
+----------------------+
| EXPLAIN |
+----------------------+
| -> Count rows in t1
|
+----------------------+
Suggested fix:
here is my test patch based on 8.4.0 :
@@ -1357,7 +1357,11 @@ static unique_ptr<Json_object> SetObjectMembers(
case AccessPath::UNQUALIFIED_COUNT:
error |= AddMemberToObject<Json_string>(obj, "access_type", "count_rows");
error |= AddTableInfoToObject(obj, join->qep_tab->table());
- description = "Count rows in " + string(join->qep_tab->table()->alias);
+ description = "Count rows in ";
+ for (uint i = 0; i < join->primary_tables; i++) {
+ description += string(join->qep_tab[i].table()->alias);
+ if (i + 1 != join->primary_tables) description += string(", ");
+ }
break;
case AccessPath::NESTED_LOOP_JOIN: {
string join_type = JoinTypeToString(path->nested_loop_join().join_type);
and result:
mysql> explain format=tree select count(*) from t1,t2,t3;
+------------------------------+
| EXPLAIN |
+------------------------------+
| -> Count rows in t1, t2, t3
|
+------------------------------+