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 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