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

Reduce the amount of redundant COUNT queries #112

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

aliaksandrb
Copy link

Hi!

Small proposal for reducing the amount of COUNT queries when the result set is full already. Kinda hits performance.

Currently, the paginator makes COUNT query for each request (unless the :count option provided by user).
On some big tables (millions records) with many filters it adds a lot to response time, as while the main result is limited by user defined limit params, like page[:size], the COUNT queries are executed against the whole table.

And it tends to be redundant if the amount of records returned for a query is already less than limit specified (as there won't be any more pages).

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.

None yet

1 participant