【发布时间】:2011-12-17 18:25:41
【问题描述】:
这个简单的查询:
SELECT trip_id from stop_times WHERE stop_id = 345
大约需要 80 毫秒,考虑到我正在迭代大约 10k 行,这实在是太多了。我的stop_times 表有大约 350 万行,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 trip_id from stop_times WHERE stop_id = 345并发布结果?
标签: mysql performance indexing