Phalcon paging issue

Phalcon $paginator->getPaginate() for all page SELECT COUNT(*) AS rowcount FROM ..;

I suggest only do the estimantion once (or none at all - just lazy loading and indicate if there is more pages) and save in session.

Thanks a lot.

BTW, I love Phalcon and wish it be perfect.


This is called premature optimization

Yeah, that COUNT can be slow if your database is way too busy inserting new rows in that table. But, RDBMS have so many limitations and solving bits of it is just not worth it. That's why we have NoSQL databases.


I wrote own paging and removed $paginator->getPaginate() in total

Good, i don't even use any pagination. Just simple offset/limit, i don't need some seperated class(and wasting memory and other stuff) for so simple tasks.

You couldn't believe how many people fail to develop manually pagination (i.e. to use offset and limit). I guess what's why it's good to have this component as well in framework such as Phalcon.