Contains on ResultSet is too slow

63 views
Skip to first unread message

om...@illusivenetworks.com

unread,
Jan 6, 2019, 10:05:17 AM1/6/19
to cqengine-discuss
Hi,
I'm using HashIndex on several properties with OnHeap persistance.
I use equal query after getting the ResultSet and I noticed that contains function is working pretty slow.
I'm iterating millions of objects and asking on contains for each of them.

What am I missing?

And another question,

If I have a indexed field and I want to ask on a specific object if he's matching a query, 
Should I use the index to get all the matching objects and then ask contains or just use query matches on that object.

Niall Gallagher

unread,
Jan 6, 2019, 10:09:35 AM1/6/19
to cqengine...@googlegroups.com
Could you provide a self contained code snippet which I can run to reproduce the issue, and I'll take a look?

The contains() method indeed should not be slow, if indexes are available.

Thanks,
Niall

           

--
-- You received this message because you are subscribed to the "cqengine-discuss" group.
http://groups.google.com/group/cqengine-discuss
---
You received this message because you are subscribed to the Google Groups "cqengine-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cqengine-discu...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

om...@illusivenetworks.com

unread,
Jan 6, 2019, 10:38:53 AM1/6/19
to cqengine-discuss
I didn't managed to create a code snippet for that, I think the contains method is not my biggest problem right now.
How about my second question?

Is there a best practice guide I can use? 

Niall Gallagher

unread,
Jan 7, 2019, 5:09:44 PM1/7/19
to cqengine...@googlegroups.com
For your second question, if you want to check if an object matches a query, it's usually more efficient to call query.matches(Object, null).

Best regards,
Niall
Reply all
Reply to author
Forward
0 new messages