Comments - Aria LIMIT clause performance

13 years, 2 months ago Michael Widenius

If the issue is that you are using a high start point for the rows, there is no way to improve the speed for this. The reason is that as rows are not ordered, there is no way to start from a certain row other than reading through all the old rows.

A better way to do this is to select rows ordered by a key field and the next query from where you left off.

Example:

SELECT * from t1 where key >= '' ORDER BY key LIMIT 1000
SELECT * from t1 where key > 'last-fetched-value' ORDER BY key LIMIT 1000
 
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.