Hi Sky,

The SQL engine is not that smart. That's why we're completely rewriting it
from scratch. In your case if a user want to see own films why are you
querying the entire film class? I think it should be something like:

SELECT inV() FROM (
  SELECT outE('own_films') FROM #13:44
) ORDER BY loved_count DESC

IF:
- #13:44 is the current user
- You have connected the films the user owns with "own_films" edge class
- You have the "love" counter in the edge as "loved_count"




Best Regards,

Luca Garulli
Founder & CEO
OrientDB <http://orientdb.com/>


On 16 August 2015 at 17:22, Sky <[email protected]> wrote:

> Hi
>
> I created a test data set of 150,000 films
>
> I include cache counters, such as owns_count, loved_count, watched_count
>
> I'm trying to write the most basic query
>
>
> SELECT FROM film WHERE owns_count > 0 ORDER BY loved_count DESC
>
> (user has applied a filter to show owned films , and ordered by most loved)
>
> It's taking an unusable 2.5 secs
>
> Removing the where clause or the order by allows the query to execute
> using the indexes (I have one for each counter, and also a composite for
> all three)
>
> Can someone advise why this may be happening? I've tried lots of
> permutations, using LETs, subqueries, reference indexes direct etc but
> cannot get the WHERE and ORDER BY clauses working together well,
> performance always seems to take a hit as it avoids the index on the order.
>
> Thanks
>
>
>
> --
>
> ---
> 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