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 approximate count #27

Open
e-e-e opened this issue Sep 16, 2018 · 0 comments
Open

Add approximate count #27

e-e-e opened this issue Sep 16, 2018 · 0 comments

Comments

@e-e-e
Copy link
Owner

e-e-e commented Sep 16, 2018

This is difficult as the cost of counting is the same as performing a search. The desire for counts is to enable us to more efficiently determine the order of complex searches, but if it takes the same time to get a count as to perform the search it is of no use.

I am thinking it could make sense to add a LRU cache that stores the count from the last search. This may become invalid, but it would at least enable some data from which to order queries when searching.

Think about queries of the type:

graph.search([
  { subject: graph.v('id'), predicate: 'rdf:type', object: 'a:CommonType' }, // matches 1000 things
  { subject: graph.v('id'), predicate: 'a:name', object: '"a unique value"' } // matches 1 thing
])

At the moment this search will get all the 1000 things and check each until it finds the one.
Approximate counts would solve this for many cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant