Query with Or is slow???

55 views
Skip to first unread message

Winarto Zhao

unread,
May 25, 2014, 9:59:02 AM5/25/14
to cqengine...@googlegroups.com
CQEngine with standard query is very fast. However I found a particular query which is very slow using Or

The following query produces result, but is very slow.
Or(Equal(bucket, 3),Equal(bucket, 4), Equal(bucket, 5))

My data that match the above query is only 94 records but when I profile during iterating the ResultSet, it took around 300 milliseconds.
The reason I said it is slow is because I have another query which only has Equal(bucket, 6) with a few thousands records matching it, but iterating the ResultSet only takes tens of microseconds.

Anyone experiencing the same?
Does using In query perform faster?

Cheers,
Wins

Niall

unread,
May 27, 2014, 6:01:58 AM5/27/14
to cqengine...@googlegroups.com
Hi Winarto,

I can't think of a particular reason why some 'or' queries would be particularly slow. They do benefit from indexes etc. But sometimes issues like this depend on the distribution of values in the data, and access patterns.

Can you provide a self-contained test case which I can run which reproduces the issue?

Thanks,
Niall
Reply all
Reply to author
Forward
0 new messages