• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
A more efficient pagination library?

#1
So the pagination library works great for working with smaller data sets. However I need to paginate a table of 500,000 records and the pagination is dogshit slow with some queries taking upwards of 30s to run.

I've been reading about it recently and am interested in implementing a more efficient pagination. Couple of articles here:

https://www.xarg.org/2011/10/optimized-p...ing-mysql/
https://www.eversql.com/faster-paginatio...t-is-slow/

Has anyone already implemented a faster pagination library for CodeIgniter before I embark on doing similar myself?
Reply

#2
I think it is not CI's pagination library that you have issue with, but the speed of your database query for pagination Smile
Reply

#3
Those optimizations are fine for an existing database, but every database is different
and needs different optimizations. There is no one way to optimize them.

It's up to you to setup the right index keys and normalization of the database.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply

#4
But even with an index pagination with that many records can be painfully slow. The alternative methods I mentioned all used the Id of the first/last items on the current page.

Anyway, by sounds of it there is no alternative pagination library already written so I will roll my own.
Reply

#5
If your going to roll your own then I would make it an Ajax Pagination Library.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply

#6
@jhob

Something is wrong if you have 500K records and your queries are taking at least 30 seconds. You might want to think about doing a database analysis to see what can be done to speed up your queries.
Reply

#7
@jhob,

I forgot to ask...what version of MySQL are you using? How are you connecting to the database ( MySQLi extension [the "i" stands for improved] or PDO [PHP Data Objects] )? Do you have a example query that takes more than 30 secs to execute.
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.