Have you created Indexes for the fields you will be searching on? For 
example:

CREATE INDEX ON :Club(name)

What is the actual query you are trying to optimize and what is the actual 
query execution plan of the query?

On Sunday, December 25, 2016 at 1:17:30 PM UTC-6, Matias Burak wrote:
>
> Well, actually I was simplifying the query but what we really need to do 
> is to filter by some property in club too (like club.name = 'FC 
> Barcelona') so that solution wouldn't work...
>
>
> El 25 de dic. de 2016 13:27 -0300, Max De Marzi Jr. <[email protected] 
> <javascript:>>, escribió:
>
> Try: 
>
> MATCH (n:`Player`) WHERE n.`international` = true RETURN SUM(
> size((n)-[:CLUB]->()) ) AS `Count`;
>
> On Saturday, December 24, 2016 at 3:55:26 AM UTC-6, Matias Burak wrote: 
>>
>> We are working with the latest 3.1 version, we have a database of around 
>> 3.5M nodes and 100M relationships. 
>> Doing some basic queries is very slow that makes the application unusable.
>>
>> neo4j-sh (?)$ profile MATCH (n1:`Club`)<-[r1:CLUB]-(n:`Player`) WHERE 
>> n.`international` = true RETURN COUNT(*) AS `Count`;
>> +---------+
>> | Count   |
>> +---------+
>> | 2181771 |
>> +---------+
>> 1 row
>> 28676 ms
>>
>> Compiler CYPHER 3.1
>>
>> Planner COST
>>
>> Runtime INTERPRETED
>>
>>
>> +-------------------+----------------+---------+---------+-------------+-----------------------------------------------+
>> | Operator          | Estimated Rows | Rows    | DB Hits | Variables   | 
>> Other                                         |
>>
>> +-------------------+----------------+---------+---------+-------------+-----------------------------------------------+
>> | +ProduceResults   |           1027 |       1 |       0 | Count       | 
>> Count                                         |
>> | |                 
>> +----------------+---------+---------+-------------+-----------------------------------------------+
>> | +EagerAggregation |           1027 |       1 |       0 | Count       | 
>>                                               |
>> | |                 
>> +----------------+---------+---------+-------------+-----------------------------------------------+
>> | +Filter           |        1054596 | 2181771 | 4872405 | n, n1, r1   | 
>> n.international == {  AUTOBOOL0} AND n:Player |
>> | |                 
>> +----------------+---------+---------+-------------+-----------------------------------------------+
>> | +Expand(All)      |        2445865 | 2445865 | 2445868 | n, r1 -- n1 | 
>> (n1)<-[r1:CLUB]-(n)                           |
>> | |                 
>> +----------------+---------+---------+-------------+-----------------------------------------------+
>> | +NodeByLabelScan  |              3 |       3 |       4 | n1          | 
>> :Club                                         |
>>
>> +-------------------+----------------+---------+---------+-------------+-----------------------------------------------+
>>
>> Total database accesses: 7318277
>>
>> There are around 2.3M players and 3 clubs. 
>> It's taking 28secs the first time, then in takes around 9-10 secs.
>> It's really annoying because it's a very simple query.
>> Is there anything we are doing wrong? Is this something we can do about 
>> or it's the expected behaviour? This is running on a 16gbRAM machine, 
>> getting more RAM is the only way to improve it?
>>
>> Thanks,
>> Matias. 
>>  
>>
> --
> You received this message because you are subscribed to a topic in the 
> Google Groups "Neo4j" group.
> To unsubscribe from this topic, visit 
> https://groups.google.com/d/topic/neo4j/uZtQWJOC1HE/unsubscribe.
> To unsubscribe from this group and all its topics, 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