r/Neo4j • u/GioAc96 • Mar 24 '22
Downsides of Graph Databases
Hello everyone. I have been looking into Neo4j and the graph db paradigm for a while, and I have to say I think it has some very compelling features. It feels like graph databases are the most sensible way to represent data, since it is the closest to how we model data in OO programming. However, it seems like the graph paradigm is struggling to take off has the mainstream way to store data, and I have no clue why that is. I assume that a good portion of the people in this subreddit have used Neo4j for a real world application, and therefore can testify on what would be the drawbacks of going the graph way. Are there any?
12
u/Immanuel_Cunt2 Mar 25 '22
A huge drawback of Neo4j is that the database is not completely open source. This causes a base reluctance, especially at universities, because it prevents deeper research on the topic. My university professor, for example, said back then that Neo4j is a great database, but important parts are not open source and that's why he won't teach it to us and only teach RDF-based approaches.
0
Mar 25 '22
[deleted]
2
u/Immanuel_Cunt2 Mar 25 '22
Haven't tried it yet. I'm actually quite happy with Neo4j, considering the ecosystem and documentation, but I'll definitely check it out.
6
u/tjk45268 Mar 24 '22
Drawbacks? New skills required, fewer professionals with graph database experience, limited number of visualization tools with graph (not just chart) visualization features. However, the number of organizations that are successfully delivering graph-based capabilities continues to grow.
2
u/venegr Mar 25 '22
I actually don't quite understand why there are not many graph database professionals even though Neo4j has been in the market for over ten years
2
u/TheOldMancunian Mar 24 '22
If your using something like Spring Data for Neo (was called Object Graph Modelling) then its very easy to learn, build new apps, and get productive. As you say, it is pretty close to a native java object store, but its so much more than that.
Drawbacks - its not MySql. I get a lot of people telling me that unless its <insert favorite RDBMS here> its not real. Once said that in a job interview. Safe to say she did not get the job!
2
u/GioAc96 Mar 24 '22
I actually know Neo4j from university quite well, and I’ve been looking into the Neo4j GraphQL library lately, but haven’t really had the chance to use it on any project. I have to say, I don’t really buy the argument that Neo4j doesn’t take off because it’s not relational, since that didn’t prevent MongoDB from becoming very popular.
How does Neo4j handle horizontal scaling? What about transaction management? I’m asking since I’m struggling to find well written unbiased material on this subject and I haven’t had any experience with Neo4j in real world enterprise applications.
6
u/Meatmow Mar 25 '22
Give the Neo4j GraphQL library a go. Its actually pretty easy to get a GRANDstack app up and running. You can get a free cloud DB with Aura and there are a bunch of YouTube videos from Neo4j about getting it up and running. We use it at our company for one of our internal apps and I love using it. The only downside I see right now is that if you want to use a managed service to host the DB, the base setup is a bit more expensive than other nosql or mysql options.
4
u/subssn21 Mar 25 '22
The only downside I see right now is that if you want to use a managed service to host the DB, the base setup is a bit more expensive than other nosql or mysql options.
I think you hit the nail on the head here. I have been playing with Neo4j for a while now and really like the technology. The deployment options and scaling costs are really scary though.
It seems like Neo4J is really working on this at least for the entry level side with the Aura Free option, but still I can't just go to any region in AWS and create an inexpensive Neo4J instance and get started like I can with MySQL, Postgres, or DynamoDB.
Then once I have built my MVP and start getting customers and have to start paying for Aura, the price ratchets up very quickly and before long you are paying Oracle prices instead of MySQL, Postgres, or DynamoDB prices.
To be fair this is perception from looking at the pricing I have seen/been given for Neo4J and comparing it the MySQL, Postgres and DynamoDB prices and may not reflect what the actual costs are when you start running the production workloads, but if the perceived cost is going to be very high, even if the actual cost is similar, it doesn't matter.
1
5
u/loradan Mar 24 '22
I think a lot of the problem is simply the prevalence of relational databases. Even NoSQL is built on top of a lot of relational database theory. The prevailing advertising for graph surrounds the importance of relationships. Most people who have been working with databases for a while tend to think of key->foreign key when they hear relationship. So they tend to dismiss the concept. When I first started learning graph databases, my first thought was exactly this. After spending time learning I realized how wrong I was 😁
5
u/Chemical_Quantity131 Jul 14 '22
If you rely on transactions for consistency, then forget Neo4j. It has lots of problems with contention, meaning lots of Deadlocks and wait for locks. On top of that, the performance for certain types of queries suffers as the amount of data grows.
4
2
u/wahoohaw Mar 25 '22
I think recent disk speed tech has enabled graph dbs to take off. The amount of data coming off neo4j in my queries binds up on slower disks.
1
u/jakob-k Nov 16 '24
Here is a few practical drawbacks I've come across so far (working with Neo4j):
- In SQL you have foreign keys that can be indexed. So a query that filters a row based on foreign keys are quick and easy to execute. For instance, return all people who work at a specific company AND is part of a specific organization (companyId and organizationId). On the graph, this query results in basically a full scan of all Person nodes, because relationships can't be indexed as such.
- SQL is super declarative which makes it very easy to model using object oriented programming, so we have ORMs available in all shapes and sizes. This is not the case for Cypher, and we end up doing a lot of ridiculous string manipulation. I hate this.
However i feel like I should mention a few upsides as well:
- N+1 and recursive queries are first class citizens of graph databases! Even N+N+N+N+N+1 (etc) queries are extremely efficient.
- Neo4j support custom server-side plugins written in Java. So for queries that are very complex, you can always fall back to writing it in Java. Which means you have support for basic polymorphism, unit and integration testing. This is a ridiculously powerful feature.
5
u/NihaoPanda Mar 25 '22
Some of the things I've run into working with Neo4j in production are
Frameworks such as Laravel/RoR are built around relational databases and won't let you take full advantage of the benefits of Neo4J
Hiring becomes harder since it's a pretty rare skill
Hosted solutions for relational db's are much cheaper
Then there are technical quirks that will frustrate you, but they're not dealbreakers