Hello all,

I try to work OrientDB since a few weeks and have a lot of fun. One 
question came around. I have some classes Product, Team and Region with 
edge classes Owns and Located. Edges are Team -> Owns -> Product and Region 
-> Located -> Product. Now I want to query fast all products owned by some 
teams and located in some regions.

Single subqueries with (given #16:1 is a team and #17:0 is a region)

*SELECT FROM (TRAVERSE out("Owns") from #16:1) where @class="Product"*
*SELECT FROM (TRAVERSE out("Located") from #17:0) where @class="Product"*

or

*SELECT EXPAND(out("Owns")) from #16:1*
*SELECT EXPAND(out("Located")) from #17:0*

work well and are very fast.

Now I want to do get the intersected rows of both queries like this:

*SELECT (EXPAND($c) LET*
*$a = (SELECT EXPAND(out("Owns")) from #16:1),*
*$b = (SELECT EXPAND(out("Located")) from #17:0),*
*$c = INTERSECT($a, $b)*

what doesn't work. I found the following gets the right result, but is 
quite slow with lots of data:

*SELECT FROM Product WHERE in_Owns.out = #16:1 AND in_Located.out = #17:0*

Is there a way to accomplish this or to speed up the last query with an 
index? Thanks for helping.

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