A. 鎬庝箞鐪嬶紝鍒嗘瀽MYSQL鐨勬墽琛岃″垝錛
MySQL
浣跨敤 EXPLAIN 鍚庨潰璺烻QL錛屽氨鐩存帴鏄劇ず鏌ヨ㈣″垝
涓嬮潰鏄涓涓渚嬪瓙錛
mysql> EXPLAIN
-> SELECT
-> SALE_DATE,
-> SUM(SALE_MONEY) AS SUM_MONEY
-> FROM
-> SALE_REPORT
-> GROUP BY
-> SALE_DATE
-> ORDER BY
-> SUM(SALE_MONEY) DESC;
+----+-------------+-------------+------+---------------+------+---------+------
+------+---------------------------------+
| id | select_type | table | type | possible_keys | key | key_len | ref
| rows | Extra |
+----+-------------+-------------+------+---------------+------+---------+------
+------+---------------------------------+
| 1 | SIMPLE | SALE_REPORT | ALL | NULL | NULL | NULL | NULL
| 1155 | Using temporary; Using filesort |
+----+-------------+-------------+------+---------------+------+---------+------
+------+---------------------------------+
1 row in set (0.00 sec)