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

Optimize has function #2724

Merged
merged 4 commits into from
Nov 5, 2018
Merged

Optimize has function #2724

merged 4 commits into from
Nov 5, 2018

Conversation

manishrjain
Copy link
Contributor

@manishrjain manishrjain commented Nov 5, 2018

Since the last change to make has(...) function to work correctly with transactions, things have been slow due to the need to build the entire posting list to determine if it has a posting or not. This PR optimizes that by utilizing BitCompletePosting. If this bit is found, then there must be a valid posting in the list, so we don't need to recreate the entire list.

This speeds up handleHasFunction considerably, for all predicates which don't have @lang index. For the predicates which have the lang index set, they're slowed down by filterStringFunction, but there's no easy fix there. Added a TODO for that.


This change is Reviewable

@manishrjain manishrjain merged commit c68a6de into master Nov 5, 2018
@manishrjain manishrjain deleted the mrjn/optimize-has branch November 5, 2018 22:48
dna2github pushed a commit to dna2fork/dgraph that referenced this pull request Jul 19, 2019
Since the last change to make `has(...)` function to work correctly with transactions, things have been slow due to the need to build the entire posting list to determine if it has a posting or not. This PR optimizes that by utilizing BitCompletePosting. If this bit is found, then there must be a valid posting in the list, so we don't need to recreate the entire list.

This speeds up `handleHasFunction` considerably, for all predicates which don't have `@lang` index. For the predicates which have the lang index set, they're slowed down by `filterStringFunction`, but there's no easy fix there. Added a TODO for that.

Partially fixes dgraph-io#2533 for preds which don't have `@lang` index.

Changelog:

* No need to retrieve posting list if we have the complete bit set. It must have at least some elements to be present.
* Understand the cause of slowdown, i.e. filterStringFunction. Improve IsEmpty func in posting/list.go
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant