這個簡單的查詢:與詮釋指數MySQL的簡單的查詢速度慢
SELECT trip_id from stop_times WHERE stop_id = 345
注意到80ms左右,這是考慮到我通過迭代10K〜行了太多的時間。我的stop_times
表有大約3.5M行,並有stop_id
索引。在這裏發生了什麼以及什麼可能會加快速度?
EXPLAIN [query]
輸出:
id: 1
select_type: SIMPLE
possible_keys: index_stop_times_on_stop_id
key: index_stop_times_on_stop_id
key_len: 5
ref: const
rows: 474
Extra: Using where
請問您可以運行'EXPLAIN SELECT stop_times where stop_id = 345'選擇trip_id併發布結果? – 2011-12-17 18:28:33