Doesn't look too bad. Would you be able to share the db with me?

Is that the first run?

What your your memory config, what kind of disk are you running on?
Can you share your graph.db/messages.log ?

Michael

On Wed, Dec 3, 2014 at 4:03 AM, li chris <[email protected]> wrote:

> yes, the profile output is:
>
> ==> 346 rows
> ==>
> ==> ColumnFilter(symKeys=["fof.uid", "
>  INTERNAL_AGGREGATE2c8089fa-e900-4621-93c3-188342ef789a"],
> returnItemNames=["fof.uid", "collect(distinct id(f))"], _rows=346,
> _db_hits=0)
> ==> EagerAggregation(keys=["Cached(fof.uid of type Any)"], aggregates=["(
>  
> INTERNAL_AGGREGATE2c8089fa-e900-4621-93c3-188342ef789a,Distinct(Collect(IdFunction(f)),IdFunction(f)))"],
> _rows=346, _db_hits=0)
> ==>   Extract(symKeys=["fof", "f", "  UNNAMED50", "me", "p", "
>  UNNAMED43"], exprKeys=["fof.uid"], _rows=45230, _db_hits=45230)
> ==>     ExtractPath(name="p", patterns=["ParsedRelation(
>  UNNAMED43,Map(),ParsedEntity(me,me,Map(uuid ->
> Literal(D0Y91L0N)),List(Person(0))),ParsedEntity(f,f,Map(),List()),List(),BOTH,false)",
> "ParsedVarLengthRelation(
>  
> UNNAMED50,Map(),ParsedEntity(f,f,Map(),List()),ParsedEntity(fof,fof,Map(),List()),List(),BOTH,false,Some(0),Some(2),None)"],
> _rows=45230, _db_hits=0)
> ==>       Filter(pred="Property(fof,uid(1)) > Literal(0)", _rows=45230,
> _db_hits=1240584)
> ==>         TraversalMatcher(start={"label": "Person", "query":
> "Literal(D0Y91L0N)", "identifiers": ["me"], "property": "uuid", "producer":
> "SchemaIndex"}, trail="(me)-[  UNNAMED43 WHERE true AND
> true]-(f)-[*0..2]-(fof)", _rows=1240584, _db_hits=1254044)
>
> Thanks Michael
>
> 在 2014年12月2日星期二UTC+8下午7时12分44秒,Michael Hunger写道:
>>
>> Can you share the profile output?
>>
>> prefix your query with "profile" in the bin/neo4j-shell or
>> http://localhost:7474/webadmin/#/console/
>>
>> On Tue, Dec 2, 2014 at 9:34 AM, li chris <[email protected]> wrote:
>>
>>> 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]> 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.
>>>
>>
>>  --
> 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