neo4j browser performing very slowly

1.3k Views Asked by At

I am running the query below in Neo4j browser. I have 2 labels and 1 relationship in the database. One label has 50,000 nodes and the other has 1,800 nodes, and there are 48,000 relationships.

MATCH (u)-[r]->(n) WITH u, COLLECT(n) AS ns, COLLECT(r) AS rs WHERE SIZE(ns) > 1 RETURN u, ns, rs

This query takes about 5 minutes to run, even though the resulting code tab says Started streaming 7437 records after 98 ms and completed after 199 ms. I thought this might be due to the visualization process so I went to configuration and put initial node display, max neighbors, and max rows all to 0. It still takes about 5 minutes. Any ideas as to what could be causing this lag?

1

There are 1 best solutions below

6
On

The lag is probably due to the fact that the server is sending a lot of data to the neo4j browser. Even if you tell the browser to not display all the returned data, it still has to process all of the data being sent from the server.

The browser should respond much quicker if you modified the Cypher query to tell the server to LIMIT the amount of data it sends back. For example, to just display 10 u nodes and their data:

MATCH (u)-[r]->(n)
WITH u, COLLECT(n) AS ns, COLLECT(r) AS rs
WHERE SIZE(ns) > 1
RETURN u, ns, rs
LIMIT 10;