Hello
My V class contains two properties prop1 and prop2 both of which are
indexed using non unique hash index.
The queries on prop1 alone (select from V where prop1 = 'xyz') or prop2
alone (select from V where prop1 = 'abc') use the index and perform well.
On the other hand, a query that uses OR in the WHERE clause (select from V
where prop1 = 'xyz' OR prop2 = abc') is very slow - it's not using index
and seems to be doing linear scan.
Any suggestions on how to optimize this query.
Here are the SQL explain results
- prop1 query (select from V where prop1 = 'xyz')
[{"@type":"d","limit":-1,"compositeIndexUsed":1,"involvedIndexes":["V.prop1"],"fullySortedByIndex":false,"indexIsUsedInOrderBy":false,"current":"#9:20000","evaluated":20,"fetchingFromTargetElapsed":0,"documentReads":20,"documentAnalyzedCompatibleClass":20,"recordReads":20,"elapsed":0.216,"resultType":"collection","resultSize":20,"@rid":"#-1:-1"}]
- prop2 query (select from V where prop2 = 'abc')
[{"@type":"d","limit":-1,"compositeIndexUsed":1,"involvedIndexes":["V.prop2"],"fullySortedByIndex":false,"indexIsUsedInOrderBy":false,"current":"#9:20025","evaluated":20,"fetchingFromTargetElapsed":0,"documentReads":20,"documentAnalyzedCompatibleClass":20,"recordReads":20,"elapsed":0.208,"resultType":"collection","resultSize":20,"@rid":"#-1:-1"}]
- prop1 or prop2 query (select from V where prop1 = 'xyz' or prop2 = 'abc')
[{"@type":"d","current":"#9:39999","evaluated":40000,"fetchingFromTargetElapsed":249,"documentReads":40000,"documentAnalyzedCompatibleClass":40000,"recordReads":40000,"elapsed":249.68301,"resultType":"collection","resultSize":40,"@rid":"#-1:-1"}]
--
---
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.