二、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执行结果总结

二、mysql索引优化分析(1)

2.2、JOIN查询结果集图解
SELECT <select_list> 
FROM tableA A
LEFT JOIN tableB B
ON A.key = B.key;

二、mysql索引优化分析(1)

SELECT <select_list> 
FROM tableA A
RIGHT JOIN tableB B
ON A.key = B.key;

二、mysql索引优化分析(1)

SELECT <select_list> 
FROM tableA A
INNER JOIN tableB B
ON A.key = B.key;

二、mysql索引优化分析(1)

SELECT <select_list> 
FROM tableA A
LEFT JOIN tableB B
ON A.key = B.key
WHERE B.key IS NULL;

二、mysql索引优化分析(1)

SELECT <select_list> 
FROM tableA A
RIGHT JOIN tableB B
ON A.key = B.key
WHERE A.key IS NULL;

二、mysql索引优化分析(1)

SELECT <select_list> 
FROM tableA A
FULL OUTER JOIN tableB B
ON A.key = B.key

二、mysql索引优化分析(1)

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

二、mysql索引优化分析(1)

2.3、建表SQL
2.4、7种join实例

3、索引介绍

4、性能分析

5、索引优化

1、性能下降SQL慢、执行时间长、等待时间长

上一篇:Oracle非重要文件恢复,redo、暂时文件、索引文件、password文件


下一篇:记mysql Insert into select语句问题