It is always known that MySQL paging is written like this:
</pre><span style= "White-space:pre" ></span><p><pre name= "code" class= "SQL" >select * From ' yourtable ' limit start,rows
Now, I have a table with 9969W data in my database, and it's called Tweet_data.
Select COUNT (*) from Tweet_data
Execute the first SQL statement, look at the beginning of 6 million article 10, see Query time
58s how slow this must be!
Solution One,
someone immediately think of using the index to improve efficiency, then we use the primary key bar, so, the following SQL
SELECT * FROM tweet_data where ID >= (select id from tweet_data limit 60000000,1) limit 10
Look at the effect
Really did not much promotion, but if the amount of data in the millions, the efficiency can be many times, but! It obviously didn't meet our requirements.
So here's the SQL statement
SELECT * from Tweet_data where id_auto_increase between 60000000 and 60000010
There is a picture for proof!
Here we only work on a table of data, and the amount of data is about 100 million, but what if our data is larger?
Then it will involve more knowledge! Little brother's humble opinion!