We always take it for granted when using mysql use
select
×
from
tables
where
a>0
order
by
id
desc
limit 500000,200
|
When we found that it actually use this query very slowly
Personally, I think this is because mysql does not index the statement, even when the index data, when the speed of reading and before 1000 when the last page in the gap between the big reason this limit
limit is a good thing, but because of his operation io The first value behind the larger limit, especially when large in the process of query
How should we do it
I www.fentutu.com use a relatively novel approach, when this method is written in a blog 163, he was mssql query is based, and now query but can not find, I find another a similar article and put in the trackbacks,
Specific method is
select
*
from
tables
where
id >=(
select
id
from
tables
where
value>0
order
by
id
desc
limit 500000,1)
and
value>0
order
by
id
desc
limit 200
|
When this statement is similar to the impression that according to this statement and I have not been really tested theory there is no syntax errors, if any, please Tell me what a simple modification of.