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

Performance improvement - Add NotEqual SimpleQuery #42

Closed
GoogleCodeExporter opened this issue Aug 23, 2015 · 4 comments
Closed

Performance improvement - Add NotEqual SimpleQuery #42

GoogleCodeExporter opened this issue Aug 23, 2015 · 4 comments

Comments

@GoogleCodeExporter
Copy link

First, thanks for this awesome library. It provides exactly what I needed, and 
it is very adaptable.

Unfortunately, in my case, a query like 'not(equals(attribute,value))' performs 
very badly without indicies, as the 'ResultSetDifference' calls has to call 
'contains' on the original query result for every element in my collection. For 
my collection the 'equals' method for each element is quite expensive (think of 
a list of maps), so the whole operation is much slower than just directly 
querying for 'notequals'.

To work around I wrote (copied from the equals implementation) the attached 
NotEquals query. Maybe it can be added and used for special cases like the one 
I mentioned. Even better would be to recognize simple negations (not(equals()), 
not(greater()), ..) and rewrite them automatically.

Original issue reported on code.google.com by felix.mannhardt on 26 Jul 2015 at 8:49

Attachments:

@GoogleCodeExporter
Copy link
Author

Hi Felix,

There will be significant performance improvements in this area in CQEngine 2.1 
actually. The way set intersections and negations are preformed has been 
changed. ResultSetDifference does not call contains() anymore, but calls a new 
matches() method instead which is more efficient at applying on-the-fly 
filtering whenever there are no indexes.

I'm setting this as Accepted for now, even though I think it is actually fixed 
in trunk already. When CQEngine 2.1 is released then maybe you could re-test 
and then we can verify at that point that it fixes your issue. I think (hope!) 
it will and if so then we can mark this Fixed.

Thanks!
Niall

Original comment by ni...@npgall.com on 26 Jul 2015 at 8:41

  • Changed state: Accepted

@GoogleCodeExporter
Copy link
Author

Original comment by ni...@npgall.com on 26 Jul 2015 at 8:41

  • Changed title: Performance improvement - Add NotEqual SimpleQuery

@GoogleCodeExporter
Copy link
Author

Perfect, I will try it out once it is released.

Original comment by felix.mannhardt on 27 Jul 2015 at 7:16

@npgall
Copy link
Owner

npgall commented Oct 26, 2015

Closing this as CQEngine 2.1 improves performance in this area.

@npgall npgall closed this as completed Oct 26, 2015
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

No branches or pull requests

2 participants