match (c: Client)-[WORKS_FOR]->(co: Company)  return c, co limit 10

This query is doing a full graph lookup and capturing 100's of millions of 
results and then only returning 10 of them.  This will never return with 
Neo4j. You need to pick a starting point in your graph and start executing 
queries from there.

MATCH (c: Client {id: 1234})
WITH c

MATCH (c)-[:WORKS_FOR]->(co: Company)
RETURN c, co

Honestly if these are the most complex queries you need to run, a 
relational database will probably work out much better for you.  Graph 
databases make sense when you will always have a starting node within the 
graph to execute queries against and your nodes are highly connected (i.e. 
you would need more than 5 or 6 table joins to execute a single query).



On Monday, June 23, 2014 5:10:57 AM UTC-7, Paul Damian wrote:
>
> Hey guys,
>
> I'm quite new to Neo4j and Cypher and I am using it to compare its 
> performance with a SQL database. I've loaded my SQL database into the graph 
> store which now has approx. 13 mil nodes and 13 mil relationships [I have 
> difficulties loading all the relationships]. The nodes are labeled Client, 
> City or Company. Obviously, a (Client)-[LIVES_IN]->(City) and 
> [WORKS_FOR]->(Company). There are about 11 mil Clients, 1 mil Companies and 
> 15K Cities.
> I'm trying to run a command to find out 10 clients and the companies they 
> work for. I've used a query like this:
> match (c: Client)-[WORKS_FOR]->(co: Company)  return c, co limit 10
> However, it keeps returning Java heap space error.
> I have already indexed the Id properties of the nodes.
>  Neo4j is installed on a vm with windows server 2012R2 Intel Xeon @ 2.27 
> GHz and 8 GB of RAM. The graph db has over 30 GB (which is weird since the 
> SQL database that was used to populate the graph only has 13 GB). 
> What can I do to improve the query performance [and get it to execute]?
>
> Thanks
> Paul
>

-- 
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 neo4j+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to