Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is Neo4j faster than SQL?

Tags:

sql

nosql

neo4j

I am a newbie to Neo4j, and can't quite understand why Neo4j must be faster than an efficient SQL query. Is it because of data structure or underlying query implementation? I really appreciate if someone can help me to get a crack on this.

like image 712
AdamNYC Avatar asked Apr 08 '12 01:04

AdamNYC


People also ask

Is Neo4j faster?

Every join makes SQL slower, but traversals in Neo4j, from node to node, tend to be almost immediate. Since most queries involve some form of deeply connected data, there is a wide array of use cases where Neo4j and other graph databases outperform standard SQL databases.

Is Neo4j better than MySQL?

Neo4j is the most famous graph database management system and it is also a NoSQL database system which is developed by Neo4j, Inc. It is different from Mysql or MongoDB as it has its features that makes it special compared to other Database Management System.

What are the weaknesses of Neo4j?

Additionally, Neo4j has scalability weaknesses related to scaling writes, hence if your application is expected to have very large write throughputs, then Neo4j is not for you.

Are graph databases faster than relational databases?

Complex queries typically run faster in graph databases than they do in relational databases. Relational databases require complex joins on data tables to perform complex queries, so the process is not as fast.


1 Answers

Neo4j ist not generally faster than an SQL database. It is just in many cases faster for graph based problems. For example if you'd like to find the shortest path between two entities Neo4j will most likely outperform MySQL etc. because of the way the data is structured and the algorithms you can use because of this structure. Neo4j stores it's data as nodes and relationships between these nodes. They are directly connected. A simple shortest path algorithm is a breadth-first search. You start at one node and expand it's connected nodes, then for each of it's children you do the same, until you find the end node. This way you will touch only a small amount of data. In an SQL query you can't do this easily, so you have to build something in your code, that traverses the result sets and generates new queries for each result and so on. So you will end up with a lot of queries.

like image 66
drexin Avatar answered Oct 03 '22 03:10

drexin