二、mysql索引优化分析(1)
作者:互联网
1、常见通用的join查询
1.1、SQL书写顺序
SELECT <select_list>
FROM
<left_table> <join_type> JOIN <right_table> ON <join_condition>
WHERE <where_condition>
GROUP BY <group_by_list>
HAVING <having_condition>
ORDER BY <order_by_condition>
LIMIT <limit_number>
1.2、SQL执行顺序
FROM <left_table>
ON <join_condition>
<join_type> JOIN <right_table>
WHERE <where_condition>
GROUP BY <group_by_list>
HAVING <having_condition>
SELECT
DISTINCT <select_list>
ORDER BY <order_by_condition>
LIMIT <limit_number>
1.3、SQL执行结果总结
2.2、JOIN查询结果集图解
SELECT <select_list>
FROM tableA A
LEFT JOIN tableB B
ON A.key = B.key;
SELECT <select_list>
FROM tableA A
RIGHT JOIN tableB B
ON A.key = B.key;
SELECT <select_list>
FROM tableA A
INNER JOIN tableB B
ON A.key = B.key;
SELECT <select_list>
FROM tableA A
LEFT JOIN tableB B
ON A.key = B.key
WHERE B.key IS NULL;
SELECT <select_list>
FROM tableA A
RIGHT JOIN tableB B
ON A.key = B.key
WHERE A.key IS NULL;
SELECT <select_list>
FROM tableA A
FULL OUTER JOIN tableB B
ON A.key = B.key
SELECT <select_list>
FROM tableA A
FULL OUTER JOIN tableB B
ON A.key = B.key
WHERE A.key IS NULL OR
B.key IS NULL
2.3、建表SQL
2.4、7种join实例
3、索引介绍
4、性能分析
5、索引优化
1、性能下降SQL慢、执行时间长、等待时间长
标签:JOIN,WHERE,tableB,索引,tableA,key,mysql,优化,SELECT 来源: https://blog.csdn.net/Michael_lcf/article/details/105003536