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)