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

Pagination - The difference between model and query builder

In implementing-your-own-adapters:

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.

My question is does using the query builder help when retreving a large number of records (Say a few thousand).

Will using the query build adapter prevent a full table scan?

I'm sorry if this is garbled thinking and goes unanswered but besides the abilty to form your own query my mind is screaming why.



98.9k
Accepted
answer

Model adapter moves the cursor over the whole resultset to get the desired page when you ask for a specific page in the paginator. Meanwhile QueryBuilder uses a LIMIT/OFFSET clause to obtain the specified page without traversing a big resultset.