Skip to content

Reduce the amount of redundant COUNT queries#112

Open
aliaksandrb wants to merge 1 commit intotiagopog:masterfrom
aliaksandrb:redundant_counts
Open

Reduce the amount of redundant COUNT queries#112
aliaksandrb wants to merge 1 commit intotiagopog:masterfrom
aliaksandrb:redundant_counts

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.

1 participant