版权声明:本文为博主原创文章,欢迎扩散,扩散请务必注明出处。
mysql explain type连接类型示例 MySQL EXPLAIN SQL 输出信息描述
方法1(命令行):EXPLAIN sql_statement 方法2(Toad):Toad里边在SQL编辑器里边点击explain plan 方法3(Navicate)Navicate里边点击解释
原始SQL语句:
SELECT c.customerNumber, c.customerName, e.lastname
FROM customers c
INNER JOIN employees e ON c.salesRepEmployeeNumber = e.employeeNumber
WHERE e.lastname LIKE 'T%'
AND EXISTS
(SELECT orderNumber, SUM(priceEach * quantityOrdered)
FROM orderdetails INNER JOIN orders USING (orderNumber)
WHERE customerNumber = c.customerNumber
GROUP BY orderNumber
HAVING SUM(priceEach * quantityOrdered) > 50000)
UNION
SELECT customerNumber, customerName, 'NULL'
FROM customers
WHERE customerName LIKE 'T%'
执行计划截图
type列示例