mysql extracted data specified range limit offset Analysis and Application

Traditional writing

offset limit, the number of extraction

SELECT * FROM yundou_management.service_order where order_status=1 order by id asc limit 108,8 ;

mysql5 support the new wording after, easier to understand

limit the number of pieces taken at offset

SELECT * FROM yundou_management.service_order where order_status=1 order by id asc limit 8 offset 108 ;

If the designation under acquired starting from the first number, offset 0

SELECT * FROM yundou_management.service_order where order_status=1 order by id asc limit 0,8 ;
SELECT * FROM yundou_management.service_order where order_status=1 order by id asc limit 8 offset 0 ;

It may be abbreviated as follows

SELECT * FROM yundou_management.service_order where order_status=1 order by id asc limit 8;

With the offset growing, query speed will become slower, the solution in the previous article has been introduced.

Reference: page optimization mysql the order data table

Guess you like

Origin blog.51cto.com/phpme/2421747