1

実行に13秒かかるmysqlクエリがあります。実行時間を短縮する方法はありますか?ここで説明します

EXPLAIN
SELECT SQL_CALC_FOUND_ROWS st.store_id as st_id, `st`.`store_id`
FROM `store` AS `st`
LEFT JOIN `coupon` AS `cp` ON st.store_id = cp.store_id
LEFT JOIN `deal` AS `dl` ON st.store_id = dl.store_id
LEFT JOIN `store_category_relations` AS `scr` ON st.store_id = scr.store_id
GROUP BY `st`.`store_id`;

+----+-------------+-------+-------+-----------------------+-----------------------+---------+---------------------+------+-------------+
| id | select_type | table | type  | possible_keys         | key                   | key_len | ref                 | rows | Extra       |
+----+-------------+-------+-------+-----------------------+-----------------------+---------+---------------------+------+-------------+
|  1 | SIMPLE      | st    | index | NULL                  | PRIMARY               | 4       | NULL                |    1 | Using index |
|  1 | SIMPLE      | cp    | ref   | store_id              | store_id              | 4       | sonicqa.st.store_id |    5 | Using index |
|  1 | SIMPLE      | dl    | ref   | idx_deal_fid_store_id | idx_deal_fid_store_id | 4       | sonicqa.st.store_id |  287 | Using index |
|  1 | SIMPLE      | scr   | ref   | store_id              | store_id              | 4       | sonicqa.st.store_id |    2 | Using index |
+----+-------------+-------+-------+-----------------------+-----------------------+---------+---------------------+------+-------------+
4 rows in set (0.00 sec)
4

1 に答える 1

0

Using indexクエリのすべてのアトミック部分で...一時ファイルはなく、すべての行を反復していません...

おそらく、最速のソリューションをすでに持っているでしょう。

ただし、1 つ質問があります。InnoDB または別のデータベース エンジンを使用していますか?

于 2012-12-21T12:29:32.953 に答える