File: idx_joins.result

package info (click to toggle)
mysql-8.0 8.0.43-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,273,924 kB
  • sloc: cpp: 4,684,605; ansic: 412,450; pascal: 108,398; java: 83,641; perl: 30,221; cs: 27,067; sql: 26,594; sh: 24,181; python: 21,816; yacc: 17,169; php: 11,522; xml: 7,388; javascript: 7,076; makefile: 2,194; lex: 1,075; awk: 670; asm: 520; objc: 183; ruby: 97; lisp: 86
file content (33 lines) | stat: -rw-r--r-- 2,780 bytes parent folder | download
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
## 
## Use 'irrational' joins to compare columns longer than the key length of the index.
##
USE performance_schema;

## HA_KEY_TYPE_TEXT
## users.user char(32) vs. hosts.host char(60)

EXPLAIN SELECT * FROM (users AS t1 INNER JOIN hosts AS t2 ON (t2.host = t1.user));
id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t2	NULL	ALL	HOST	NULL	NULL	NULL	#	100.00	Using where
1	SIMPLE	t1	NULL	eq_ref	USER	USER	129	performance_schema.t2.HOST	#	100.00	Using where
Warnings:
Warning	1739	Cannot use ref access on index 'HOST' due to type or collation conversion on field 'HOST'
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`)

SELECT COUNT(*) FROM (users AS t1 INNER JOIN hosts AS t2 ON (t2.host = t1.user));
COUNT(*)
#

## HA_KEY_TYPE_VARCHAR1 or HA_KEY_TYPE_VARCHAR2
## file_instances.file_name varchar(512) vs. session_variables.variable_name varchar(1024)

EXPLAIN SELECT * FROM (file_instances AS t1 INNER JOIN session_variables AS t2 ON (t2.variable_value = t1.file_name));
id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t2	NULL	ALL	NULL	NULL	NULL	NULL	#	100.00	Using where
1	SIMPLE	t1	NULL	eq_ref	PRIMARY	PRIMARY	2050	performance_schema.t2.VARIABLE_VALUE	#	100.00	Using where
Warnings:
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`)

SELECT COUNT(*) FROM (file_instances AS t1 INNER JOIN session_variables AS t2 ON (t2.variable_value = t1.file_name));
COUNT(*)
#