We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Paginator memory leak?

Hey guys!

// Passing a resultset as data
$paginator = new PaginatorModel(
    [
        'data'  => Products::find(),
        'limit' => 10,
        'page'  => $currentPage,
    ]
);

What's the point in this option, if the records are 1 million? They will all be remembered. Or not? Tell me how to do data pagination in which large volumes.



93.7k
Accepted
answer

https://olddocs.phalcon.io/en/3.0.0/reference/pagination.html

"Use a Phalcon\Mvc\Model\Resultset object as source data. Since PDO doesn’t support scrollable cursors this adapter shouldn’t be used to paginate a large number of records"

I'm pretty much always using the QueryBuilder to create my queries.