Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Performant pagination #112

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

jmcarp
Copy link

@jmcarp jmcarp commented Aug 5, 2015

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
    }
}

Instead of fetching all results and paginating in memory, use the
pagination helpers built into Flask-SQLAlchemy.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant