Hi,
Do you have an index against Actor.name? If yes, in order to use it
avoiding to scan all the movies, you should do something like:

SELECT expand(out('ACTS_IN')) FROM Actor WHERE name = 'Tom Hanks'

In this way you find all the movies where "Tom Hanks" had a role. NOTE: I'm
not sure about the names of your vertex/edge classes.

To find all the actors that worked with Tom Hanks, this should be the final
query:

SELECT COUNT(name) as name FROM (
  SELECT expand(out('ACTS_IN').in('ACTS_IN')) FROM Actor WHERE name = 'Tom
Hanks'
) WHERE name <> 'Tom Hanks';

This should be much faster ;-)


Best Regards,

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


On 31 January 2016 at 22:50, bma <[email protected]> wrote:

> Hello folks,
>
> I've been doing some comparison tests between DBs. I'm using Movies
> dataset from Neo4j (60k nodes, 200k connections).
>
> The algorithm I'm using is basically just a Friend of a Friend algorithm.
>
> This query, takes more than 7s, while the one in Neo4j takes under 0.4s.
>
> SELECT COUNT(name) as name FROM (SELECT expand(in('ACTS_IN')) FROM Movie
> WHERE in('ACTS_IN').name in 'Tom Hanks') WHERE name <> 'Tom Hanks';
>
> Any idea why such a big difference?
>
> --
>
> ---
> 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