Neo4j can do it in 2.7 seconds on my 4 year old laptop. 
Read 
https://maxdemarzi.com/2017/02/06/neo4j-is-faster-than-mysql-in-performing-recursive-query/
 
to find out how.

On Monday, February 6, 2017 at 4:38:25 AM UTC-6, Chris Vest wrote:
>
> A 100 friends per customer is a somewhat high cardinality. 
> Going out four levels you get 100 to the power of 4, 100.000.000 friends 
> out of 10.000, then "distinctified". 
> There's probably a good chance that the result is just the complete 
> Customer set. 
> You should take a look at the query plans for both and see if MySQL is 
> able to come up with a smarter plan. 
> Also make sure that you have indexes on the initial customer lookup. 
> And the queries have to be run many times to let each database warm up 
> properly. 
> Neo4j needs more warmup iterations because the database itself is JIT 
> compiled by the JVM. 
> If you reduce the degree, say to 10 for instance, you might see Neo4j 
> perform better than MySQL; especially if you also increase the search 
> depth. 
>
> -- 
> Chris Vest 
> System Engineer, Neo Technology 
>
>
> > On 30 Jan 2017, at 19.02, Artur Rudalski <[email protected] 
> <javascript:>> wrote: 
> > 
> > Hi all! 
> > 
> > starts from beginning, I would like to check performance MySQL and Neo4j 
> in graph traversing therefore I created sql database composed of two 
> tables: customer and customerfriend. Second one contains two keys: 
> CustomerID, and FriendID which point to CustomerID in customer table. In 
> Neo4j I created corresponding entities - 'Customer' nodes and 'FRIEND_OF' 
> relations - (c:Customer)-[f:FRIEND_OF]->(cc.Customer) . Both databases 
> contain same data: 100000 Customers, each Customer has 100 relations. 
> > I perfomed tests using below queries: 
> > 
> > Neo4j: 
> > match (c:Customer{CustomerID:99})-[:FRIEND_OF*4]->(cc:Customer)   
>  (240s) 
> > return distinct cc.CustomerID; 
> > 
> > MySQL: 
> > 
> > SELECT distinct cf4.FriendID FROM customerfriend cf1     (60s) 
> > join customerfriend cf2 on cf1.FriendID = cf2.CustomerID 
> > join customerfriend cf3 on cf2.FriendID = cf3.CustomerID 
> > join customerfriend cf4 on cf3.FriendID = cf4.CustomerID 
> > where cf1.CustomerID =99; 
> > 
> > I have tested queries for 50 relations per customer, and I achieved same 
> results (Neo4j slower than MySQL) 
> > 
> > Queries are run from simple Java application, which just connect to 
> database (using available connectors), run queries and measure execution 
> times. 
> > 
> > Finally I recieved unexpected results- Neo4j is slower than MySQL in 
> performing above query (Neo4j 240s, MySQL 60s). Before starting my tests I 
> read some articles which shows that Neo4j works better in case of recursive 
> queries than MySQL, that's why I'm start wondering if I'm doing something 
> wrong or measured times are proper (?). 
> > I'm wondering if in Neo4j exists any possibilites to tune system 
> performance (increase buffer size or something). In case of MySQL I set up 
> innodb_buffer_pool_size to 3G which affected better query performace 
> (shorter execution time). 
> > 
> > These tests are crucial for experimental part in my myster thesis and 
> I'll be very greatful for any hints and help 
> > 
> > Thanks in advance! 
> > 
> > Artur 
> > 
> > -- 
> > 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] <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