In their new book, Neo4j In Action, Jonas Partner and Aleksa Vukotic perform a fascinating experiment. In theory, a graph database should be much faster than a relational databases in graph traversal. For example, in a social network, finding all the friends of a user’s friends. Even more so for friends of friends of friends. Aleksa and Jonas built this query in both MySQL and Neo4j with a database of 1,000,000 users and the results are striking. Execution Time is in seconds, for 1,000 users.
Depth Execution Time – MySQL Execution Time –Neo4j
2 0.016 0.010
3 30.267 0.168
4 1,543.505 1.359
5 Not Finished in 1 Hour 2.132
  For the simple friends of friends query, Neo4j is 60% faster than MySQL. For friends of friends of friends, Neo is 180 times faster. And for the depth four query, Neo4j is 1,135 times faster. And MySQL just chokes on the depth 5 query. The results are dramatic. Read about the whole experiment in the first chapter of Neo4j In Action.  


Leave a Reply
Your email address will not be published.

Benchmarketing – Neo4j and MySQL | intertubes

[…] 4 levels, that’s faster than the Neo4j times given at .  For 5 levels, it’s slower, but nothing like the “not finished in an hour” listed.  In […]


Obviously there are theoretical data in the post according remark “In theory, a graph database should be much faster than a relational databases in graph traversal”. On practics results are opposite. Oracle find 5,6,10,…25 deep friends for second and minutes, Neo4j has died after 6 step. Details here:


I wonder, what kind of data model is used within the book. The example on seems very complete and doesn’t leave much space for doubts. So, how is it possible that two benchmarks, testing exactly the same thing, result in the exact opposite extrem cases, one could think of? With such kind of articles, we are all left alone, doing our own performance tests on each and every kind of data model.

Gaël Guernalec

A little mistake can be found here :
From your results, FOAF in Neo4j is 40% faster than MySQL but MySQL is 60% slower. *

1 Trackback