Hello,

we're trying to improve performance for complex queries and realized some 
glitches in using indexes in OrientDB. Query looks like this (simplified):

*SELECT FROM MyClass WHERE Field1 = "valueA" AND (Field2 = "valueB" OR 
Field2 = "valueC")*

A variation is

*SELECT FROM MyClass WHERE Field1 = "valueA" AND Field2 LUCENE "valueB OR 
valueC"*

Both Field1 and Field2 have an index (we tried both normal BTree and Lucene 
for Field2).

Is it correct that OrientDB only uses 1 index (for the left field) if an 
AND condition is used? While the 1st query always works, the 2nd fails. We 
have to swap the conditions to 

*SELECT FROM MyClass WHERE Field2 LUCENE "valueB OR valueC" AND Field1 = 
"valueA"*

We found out that depending on the index used and the size of the result, 
query times can vary very much. Lucene seems much faster having a lot of 
ANDs and ORs for a field. But query performance is getting worse if the 
result size of the index query is big related to the size of the class. An 
optimal scenario would be to have a condition on the left with an index 
leading to a small subset. Is this correct? We tried

*SELECT FROM (TRAVERSE ...) WHERE Field1 = "value1"*

too, but if the inner TRAVERSE returns lots of records, the query gets slow.
Someone has some thoughts or ideas on it? Thanks in advance.

Patrick

-- 

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

Reply via email to