thanks Michael,

I have created uniqueness constraint like this:CREATE CONSTRAINT ON 
(person:Person) ASSERT person.uuid IS UNIQUE

there is only one relationship-type and direction is not useful in my 
application.

uuid is the user id from facebook, uid is the user id of my application

the result has many repeated uid if no distinct

now the query is:

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



在 2014年12月2日星期二UTC+8上午2时57分23秒,Michael Hunger写道:
>
> 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] <javascript:>> 
> 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] <javascript:>.
>> 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