Hi Khaled

which version of OrientDB are you using?



2015-06-10 14:29 GMT+02:00 Khaled Bakhit <[email protected]>:

> Hello,
>
> I need help optimizing a query or maybe even update the graph structure.
>
> I have the following relation :
>
> User ( userid, country ) - - - - - Likes - - - - > Movie ( movieid )
>
> movieid and userid are unique indexes, while country is a non-unique index.
>
>
> I'm using the following query to get the first 500 users who liked movie x
> from country y.
>
> SELECT userid FROM (SELECT expand(in("Likes")) FROM Movie WHERE movieid=
> 112 limit 500) WHERE country="US"
>
> The problem is this does not get guarantee getting 500 users from US (
> because the query first gets first 500 users and then filters by country ).
> Removing the limit 500 is not an option as well since some movies can have
> millions of likes.
>
> Any suggestions on improving this issue and have the country index get
> used from within the Movie subquery?
>
> Thank your for your help and this great product :)
>
>
>
>  --
>
> ---
> 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.
>

-- 

--- 
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