Hi SavioL,

Thank you for your answer.

I have a concern, would the response time increase as number of Likes 
increase?


On Thursday, June 11, 2015 at 11:14:05 AM UTC+3, SavioL wrote:
>
> Hi,
>
> you should take before all users Americans who likes as the id of the movie 
> you want, and then filter by number.
>
> SELECT userid FROM (  select from (SELECT expand(in("Likes")) FROM Movie 
> where movieid = 112) WHERE country="us"  ) limit 500
>
> regards
> Savio L.
>
> Il giorno mercoledì 10 giugno 2015 17:44:50 UTC+2, Khaled Bakhit ha 
> scritto:
>>
>> 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.

Reply via email to