create index on :Person (uuid);

what kinds of relationship-types do you have?

Try to a dd a direction:

depending on your avg relationship-count, you might visit rels^steps paths,
e.g. for 100 rels per person and you have up to 4 steps it is 100^4 or 100M
paths

You also have a typo in your query fof.uid should probably be fof.uuid same
in the return clause ??
Also you treat uid as numeric while uuid seems to be string ?

if you do aggregation you don't need distinct
and it doesnt really make sense to aggregate friends by friends of friends

MATCH p = (me:Person{uuid:'D0Y91L0N'})-[]->(f)-[*0..3]->(fof)
WHERE fof.uid > 0
WITH distinct fof.uid, collect(distinct id(f))

I think it would help to take the Neo4j online training again.
http://neo4j.com/online-training


Cheers, Michael

On Sun, Nov 30, 2014 at 11:07 AM, li chris <[email protected]> wrote:

> Hi all,
> I'm leaning to use neo4j for relation analysis recently. Today I found it
> took too long for my cypher query took to finish.
>
> neo4j version: 2.0.2
> nodes num: 350,000
> relation num: 370,000
> cypher query:
>
> MATCH p = (me:Person{uuid:'D0Y91L0N'})-[]-(f)-[*0..3]-(fof)
> WHERE fof.uid > 0
> WITH distinct fof.uid, collect(distinct id(f))
>
>
> the query take 37s for 346 rows.
>
> What should I do to improve my query performance? Any suggestions would be
> appreciated!
>
> Thanks in advance.
>
> chris
>
> --
> You received this message because you are subscribed to the Google Groups
> "Neo4j" 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 
"Neo4j" 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