| 1 |
## |
| 2 |
## Use 'irrational' joins to compare columns longer than the key length of the index. |
| 3 |
## |
| 4 |
USE performance_schema; |
| 5 |
|
| 6 |
## HA_KEY_TYPE_TEXT |
| 7 |
## users.user char(32) vs. hosts.host char(60) |
| 8 |
|
| 9 |
EXPLAIN SELECT * FROM (users AS t1 INNER JOIN hosts AS t2 ON (t2.host = t1.user)); |
| 10 |
id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 11 |
1 SIMPLE t2 NULL ALL HOST NULL NULL NULL # 100.00 Using where |
| 12 |
1 SIMPLE t1 NULL eq_ref USER USER 129 performance_schema.t2.HOST # 100.00 Using where |
| 13 |
Warnings: |
| 14 |
Warning 1739 Cannot use ref access on index 'HOST' due to type or collation conversion on field 'HOST' |
| 15 |
Note 1003 /* select#1 */ select `performance_schema`.`t1`.`USER` AS `USER`,`performance_schema`.`t1`.`CURRENT_CONNECTIONS` AS `CURRENT_CONNECTIONS`,`performance_schema`.`t1`.`TOTAL_CONNECTIONS` AS `TOTAL_CONNECTIONS`,`performance_schema`.`t1`.`MAX_SESSION_CONTROLLED_MEMORY` AS `MAX_SESSION_CONTROLLED_MEMORY`,`performance_schema`.`t1`.`MAX_SESSION_TOTAL_MEMORY` AS `MAX_SESSION_TOTAL_MEMORY`,`performance_schema`.`t2`.`HOST` AS `HOST`,`performance_schema`.`t2`.`CURRENT_CONNECTIONS` AS `CURRENT_CONNECTIONS`,`performance_schema`.`t2`.`TOTAL_CONNECTIONS` AS `TOTAL_CONNECTIONS`,`performance_schema`.`t2`.`MAX_SESSION_CONTROLLED_MEMORY` AS `MAX_SESSION_CONTROLLED_MEMORY`,`performance_schema`.`t2`.`MAX_SESSION_TOTAL_MEMORY` AS `MAX_SESSION_TOTAL_MEMORY` from `performance_schema`.`users` `t1` join `performance_schema`.`hosts` `t2` where (`performance_schema`.`t2`.`HOST` = `performance_schema`.`t1`.`USER`) |
| 16 |
|
| 17 |
SELECT COUNT(*) FROM (users AS t1 INNER JOIN hosts AS t2 ON (t2.host = t1.user)); |
| 18 |
COUNT(*) |
| 19 |
# |
| 20 |
|
| 21 |
## HA_KEY_TYPE_VARCHAR1 or HA_KEY_TYPE_VARCHAR2 |
| 22 |
## file_instances.file_name varchar(512) vs. session_variables.variable_name varchar(1024) |
| 23 |
|
| 24 |
EXPLAIN SELECT * FROM (file_instances AS t1 INNER JOIN session_variables AS t2 ON (t2.variable_value = t1.file_name)); |
| 25 |
id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 26 |
1 SIMPLE t2 NULL ALL NULL NULL NULL NULL # 100.00 Using where |
| 27 |
1 SIMPLE t1 NULL eq_ref PRIMARY PRIMARY 2050 performance_schema.t2.VARIABLE_VALUE # 100.00 Using where |
| 28 |
Warnings: |
| 29 |
Note 1003 /* select#1 */ select `performance_schema`.`t1`.`FILE_NAME` AS `FILE_NAME`,`performance_schema`.`t1`.`EVENT_NAME` AS `EVENT_NAME`,`performance_schema`.`t1`.`OPEN_COUNT` AS `OPEN_COUNT`,`performance_schema`.`t2`.`VARIABLE_NAME` AS `VARIABLE_NAME`,`performance_schema`.`t2`.`VARIABLE_VALUE` AS `VARIABLE_VALUE` from `performance_schema`.`file_instances` `t1` join `performance_schema`.`session_variables` `t2` where (`performance_schema`.`t2`.`VARIABLE_VALUE` = `performance_schema`.`t1`.`FILE_NAME`) |
| 30 |
|
| 31 |
SELECT COUNT(*) FROM (file_instances AS t1 INNER JOIN session_variables AS t2 ON (t2.variable_value = t1.file_name)); |
| 32 |
COUNT(*) |
| 33 |
# |