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

Add smart count #314

Merged
merged 4 commits into from
Nov 14, 2018
Merged

Add smart count #314

merged 4 commits into from
Nov 14, 2018

Conversation

andrykonchin
Copy link
Member

@andrykonchin andrykonchin commented Nov 11, 2018

Implement #count method for Query/Scan chain in efficient way.

Current implementation downloads all the documents in order to calculate Query/Scan result's size.

Proposed implementation doesn't do it and uses Select: "COUNT" options to return only count and scanned_count in response (API documentation).

So now Document.where('age.gt': 10).count works much more efficiently.


Related issues: #144 and #301

Copy link
Member

@pboling pboling left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks really good!

@andrykonchin andrykonchin merged commit d04c265 into master Nov 14, 2018
@andrykonchin andrykonchin deleted the add-smart-count branch November 14, 2018 19:19
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.

2 participants