Recently in our team, we had a requirement to paginate a set of content. Where we decided to go with jQuery Database table pagination. i.e.
- Fetch the whole content with one DB call
- Paginate using jQuery Database table (most likely like a client side pagination)
My concern here is, we are holding the whole object in the memory for pagination which would affect performance.
My alternative here is to hit the database using offset and max for each pagination, here DB hit might be another concern.
So my question here is Which is the best approach for pagination considering performance as the main factor?
Holding the whole content in memory or hitting the DB for each page ?