sandman icon indicating copy to clipboard operation
sandman copied to clipboard

Performant pagination

Open jmcarp opened this issue 10 years ago • 0 comments

Sandman currently fetches all results in a query set, then applies offsets and limits in memory. It's more efficient to offload pagination to the database. This patch uses the pagination helpers built into Flask-SQLAlchemy to apply offsets and limits in the database. All result sets are now paginated, and pagination metadata are included in JSON responses:

{
    resources: [...],
    pagination: {
        page: 4,
        per_page: 20,
        count: 100
    }
}

jmcarp avatar Aug 05 '15 15:08 jmcarp