Is there anyway to avoid using LIMIT $page,$offset when retrieving rows in codeigniter pagination?
When i use limit with offset on milions records when retrieving for example LIMIT 300000,45 query takes about 6 second more then retrieving LIMIT 45,45
Which is the best and fastest way to paginate records?
thanks 🙂
My table looks so:
id (AUTO) | username | password | email
i used a simple query:
SELECT * FROM table ORDER_BY username ASC LIMIT 300000,45
In the case
LIMIT 45, 45you are selecting 45 rows with an ofset of 45, whereas theLIMIT 45, 300000limits 300000 rows from the offset 45. This may explain the speed issue.