Understand mysql_limit optimization ideas

Limit is to query all records for range limit input. It will cause io to read the previously unneeded records.
The overall idea of ​​optimization is to operate io as little as possible. Common methods:
    1. Use the method of recording the primary key to optimize,
         such as: select * from p2p_20131230 where main_id > 1000000 order by main_id limit 10; 
    2. Use subqueries to query
select * from p2p_20131230 where main_id >= (select main_id from p2p_20131230 limit 1000000,1) limit 10; 
    3. Use between keyword

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326175138&siteId=291194637