Hello guys, I need your help.
I need optimize this tables in query join and tried the syntax EXPLAIN SELECT.
My answer is: why don’t show in the columns ‘key’ the key ‘tel,action’ assigned in the table ‘tbl_A’?
According to the output of EXPLAIN SELECT how to optimize my tables?
Can you help me?
Thank you in advance.
mysql> EXPLAIN SELECT
u.tel AS tel,
CASE
WHEN action IS NOT NULL THEN
CONCAT(
'***',
u.tel,
'***',
' ',
u.action
)
WHEN u.Notes IS NOT NULL THEN
CONCAT(
'***',
u.tel,
'***',
'Notes'
)
ELSE
u.tel
END AS tel_1
FROM
tbl_A u
JOIN tbl_B ON u.tel = tmp.tel
WHERE
(
u.action NOT IN ('Regular')
OR u.action IS NULL
)
GROUP BY
tel
ORDER BY
tel ASC;
+----+-------------+-------+------+----------------+---------+---------+----------+-------+----------------------------------------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
| 1 | SIMPLE | u | ALL | tel,action | NULL | NULL | NULL | 22955 | Using where; Using temporary; Using filesort |
| 1 | SIMPLE | tmp | ref | tel | tel | 258 | db.u.tel | 55 | Using where; Using index |
+----+-------------+-------+------+----------------+---------+---------+----------+-------+----------------------------------------------+
2 rows in set
mysql>