-
Notifications
You must be signed in to change notification settings - Fork 617
Index-Free: Only exclude limit queries if last document changed #737
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
Index-Free: Only exclude limit queries if last document changed #737
Conversation
// limit. If the last document was edited after the query was last synchronized, there is a | ||
// chance that another document from cache sorts higher, in which case we have to perform a full | ||
// cache scan. | ||
Comparator<Document> comparator = query.comparator(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment doesn't really explain why only the last document matters and it took me a while to reason it through.
Maybe add a paragraph explaining why changes to documents that are not the last document don't matter?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. Can you take another look?
2861847
to
d583283
Compare
d21d094
to
6dd7e82
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Instead of not using Index-Free queries for all limit queries with modified documents, we can take advantage of the fact that documents edit that don't affect the boundary (last document) don't cause other documents from cache to suddenly fall into the limit.