Phalcon slow page load - large table with querybuilder + paging

Hi,

have been searching around on how phalcon handles large database and found below related info

https://forum.phalconphp.com/discussion/7303/phalcon-with-large-database

I have tried the querybuilder for pagination and the page load quite some times (tested with 400k+ data - Mysql).

Sample controller as below. Is there any extra configuration need to be included? Is there any ways we can do this with partial page load instead whole page load?

Thanks guys

    public function indexAction()
    {

     // Build query and Paginator
    $builder = $this->modelsManager->createBuilder()
        ->
        ->from("UserPortal")
        ->orderBy('ID DESC');

    $paginator = new \Phalcon\Paginator\Adapter\QueryBuilder(array(
        "builder" => $builder,
        "limit" => 20, // Or u can use some predefined value
        "page" => $this->request->getQuery('page', 'int')
    ));

    $this->view->page = $paginator->getPaginate();

    //echo "<pre>";
    echo json_encode($this->view->page->items->toArray());
    //echo "</pre>";
    }

http://s3.postimg.org/8i3y6gjnn/slow%5load.png

Maybe create an index on field id descendent could help.



358

Thanks Andres, after creating index on this table, the first load was excellent. But upon selecting Last paging, it seems the load time increase. Is this normal?

http://s17.postimg.org/qx41gr9b3/slow%5load.png