I've got a table with int
field, let's call it createTime
. The table consists of few million records. Now I want to run the query:
select * from `table` order by `createTime` desc limit 500000, 10
I've created an index for createTime
, but the query runs INCREDIBLY slow. What's the reason? How can I improve it?
Here's what EXPLAIN says:
id 1
select_type simple
table table
type index
possible_keys null
key createTime
key_len 4
ref null
rows 500010
extra
As for the offset, it's working much faster when it's small.