If i have one million rows in mysql table, how use paginator?

If i have one million rows in mysql table, how use paginator?

Interesting!! I think you need to do the following ;

->nomalize the tables. ->have search functionality in your application. ->Create menu for your data View. The menu can have submenu etc.

Just working on the structure first before getting down to pagination.



4.3k
edited May '15

To use paginator with a resultset that large, you'll want to look here:

http://docs.phalconphp.com/en/latest/reference/pagination.html#adapters-usage

Look at the example using "QueryBuilder"

//Passing a querybuilder as data

$builder = $this->modelsManager->createBuilder()
    ->columns('id, name')
    ->from('Robots')
    ->orderBy('name');

$paginator = new PaginatorQueryBuilder(array(
    "builder" => $builder,
    "limit"   => 20,
    "page"    => 1
));

That will query only the results you're looking for on any given page instead of the entire resultlet.