4 ms·
When would I use Neo4j over a relational sql database like PG/MySQL?
by KurtMueller 10y ago
When would I use Neo4j over a relational sql database like PG/MySQL?
- chatmasta 10y agoUltimately it's up to you, of course. But the most obvious use case would be when you're building something explicitly modeled onto a graph, like a social network.
- johnymontana 10y agoIf you are writing lots of joins in SQL, that might be a good use case for a graph database like Neo4j. Neo4j treats relationships as first class citizens, so really anytime you care about relationships in your data you might have a good graph use case. One way to think about relationships in graph databases is as materialized joins. Relationships are modeled and stored explicitly so there is no join at query time, only a constant time graph traversal. There are differences in flexibility of data model, ease of expressing traversals in the query language, etc but I think traversal vs JOIN is a good way to compare relational vs graph.
- brightball 10y agoMy understanding is if you had widespread, conditional joins. I haven't ever implemented though, so somebody feel free to correct me if I'm wrong here: Example: News Feed - JOIN with my friends - JOIN recent posts - JOIN topics / keywords that I tend to care about - Filter by people I interact with more - Filter out shared posts from sources I ignore - Sort by some combination of recency, likes, likes from my friends The idea, it seems, is to be optimized for wide joins.