Let’s say I have an ActiveRecord query which has 1 million records as result and I’m using WillPaginate to (of course) paginate this result.
So, my doubt is:
All these 1 million records are stored somehow in memory or the will_paginate query gets executed again to retrieve more and more records ?
I hope I’m being clear 🙂
No, it won’t repeatedly grab all 1 million records. The queries look something like this:
…where
Xis the maximum per page, andYis the number of records to skip from the top of the stack, as determined byX * (current_page - 1).