ruby-on-railspaginationkaminari

Kaminari without COUNT


Can Kaminari work without hitting the DB with a COUNT(*) query?

My app's database is huge and counting the items takes much much longer than getting the items itself, leading to performance issues.

Suggestions for other pagination solutions with large datasets are also welcome.


Solution

  • Well, Kaminari or will_paginate needs to count total somehow in order to determine total_pages to be rendered. This is inevitable. My solution was to look at the database query and try to optimize it. That's the way to go.

    (this answer is outdated, see above answers)