First, global vision Act
If it is the primary key to the modulo sub-library
Each library execution: order by time offset 0 limit X + Y;
Library service layer multiplied by the N (X + Y) th data obtained for memory ordering, the memory records after sorting will take Y after X-offset;
Disadvantages: The larger the page, the more data is taken out.
Second, the law prohibits jump page inquiry
(1) The first page data acquired by the normal method (the first method), and recorded in a first page time_max obtained;
(2) each page, the
order by time offset X limit Y;
Rewrite
order by time where time>$time_max limit Y;
In order to ensure that each return only one page of data, the performance is a constant.
Third, the second query method
(1) SQL rewrite the
order by time offset X limit Y;
Rewrite
order by time offset X/N limit Y;
N represents the number of sub-library.
(2) Multi-page return, find the minimum time_min;
(3) secondary query
order by time between $time_min and $time_i_max;
The results (4) secondary queries, merging, sorting, the outcome