MySQL Forums
Forum List  »  Newbie

Re: Heavy task on mysql by AJAX Pagination?
Posted by: Barry Galbraith
Date: August 26, 2011 06:01PM

>Exactly! I wonder why people shifting to this modern trick.

You can make an AJAX call to get just the 10 rows you want.

The real trick is to remember the index of the last row you showed, and then get 10 rows beginning from greater than the last one.

Don't do LIMIT 20,000 10. You have to read 19,999 rows before you get to the 10 you want.
Much beter to
SELECT ...
FROM ....
WHERE index > last_index_read
LIMIT 10
That way you use an index to find your 1st row (really fast) and then only read 10 rows.
And, what's more, you CAN do that with AJAX!

Good luck,
Barry.

Options: ReplyQuote


Subject
Written By
Posted
Re: Heavy task on mysql by AJAX Pagination?
August 26, 2011 06:01PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.