Live data from Hacker News

Ask HN: If you've used a graph database, would you use it again?

news.ycombinator.com

31–40 of 84 posts

Re: Ask HN: If you've used a graph database, would you use it again?

#31
I used Neo4j for a few side projects but my go-to is still PostgreSQL. The largest flaw I see with Neo4j (and probably other graph databases as well) is that it forces you to think of your entities as either vertices or edges and that line tends to be not as clear as you might expect.

For example: (:Person)-[:BEFRIENDS]->(:Person)

If we'd want to store a date with that relationship, Neo4j got your back, that's entirely possible (= relationships can have attributes). But now our requirements change and we'd also want to have an entity for Events shared by friends (e.g. friendship anniversary), now we have to remodel our data to something like:

(:Person)-[:IS_IN]->(:Friendship)-[:HAS]->(:Event)

In SQL that wouldn't have been a remodel, because there's no difference between a relationship and an entity. We would've gone from:

Person(id) Friendship(person1_id, person2_id)

to:

Person(id) Friendship(person1_id, person2_id) Event(friendship_id)

So I feel like the vertice/edge distinction Neo4j makes, gets in the way of changing data model needs and I ultimately think that modeling your data as a graph is not helpful. Though it can be extremely helpful in querying and that's where its biggest strength lies.

Re: Ask HN: If you've used a graph database, would you use it again?

#32

I started using Neo4j 8 years ago after a long time as a relational database developer. I needed it for a project building a LinkedIn clone with skills (at the time LinkedIn didn't have skills). I was going to need a massive join table of user-skill-user and decided it was best in a graph. I built a ruby gem "neography" as a Neo4j driver and became an open source contributor. Later Neo4j contracted me to build a rule…

How is a graph database built under the hood?

I know that a decent RDBMS (simplified) will consist of the following:

- data in blocks organised with a block-size that the underlying filesystem likes

- a cache for the most frequently used blocks

- every index is a B-Tree with pointers to the blocks containing the tuples

Then there are column stores as well as row stores, and for compression you might have some dictionary encoding going on.

Now, how does the Graph Database look under the hood and what are the complexities involved? How is the Graph persisted?

Re: Ask HN: If you've used a graph database, would you use it again?

#33
I'm currently using a home-baked graph database built on top of PostgreSQL for https://unlikekinds.com

It stores information as triples (Bob -> Married to -> Gary) and with properties (Bob.last_name = Stamper)

I've been finding that the benefits keep on paying off. I can arbitrary relate any thing to any other thing (and query those relationships) without changing code or database schema at all.

And the fact that it's a literal, intuitive, representation of reality makes things much easier to reason about.

When viewing something and seeing all the related info, the data nerd in me loves it: https://unlikekinds.com/t/unlike-kinds (meta)

Re: Ask HN: If you've used a graph database, would you use it again?

#34

I've been using RDF and triplestores / RDF databases for the last half-decade, developing both front-end and back-end systems, and training many developers to work in RDF. If you're used to either relational databases or object-oriented design, it's a really different way of thinking about data. Just like OOP is really good for certain kinds of problems and models, and RDBMS is good for other kinds of problems and mo…

Is there a particular RDF store which you would recommend? It seems scaling is a bit of an issue with Apache Jena. It's very easy to bring to entire system to a crawl with certain sparql queries and enough data in the store.

Re: Ask HN: If you've used a graph database, would you use it again?

#35
post #22
post #18

Earlier quoted context omitted.

Transaction isolation is a no-brainer, so I don't think your example holds. Also, your example is not related to the algebra but to isolation. "Claiming ACID" what is ambiguous about that? Transaction support with different serialization levels, like other databases that offer it. And Neo4j originally started b/c RDBMS was not able to execute the complex deep traversals needed in real time. Dedicated storage & query…

> "Claiming ACID" what is ambiguous about that? Transaction support with different serialization levels, like other databases that offer it. A non-graph-database would not provide operators like deep traversals. Operations are tightly bound to ACID as a whole, not just isolation. Of course ACID would always hold if you strictly linearize everything, but that defeats the purpose of data management, and one would achie…

> A non-graph-database would not provide operators like deep traversals

You can do this with a recursive common table expression.

Re: Ask HN: If you've used a graph database, would you use it again?

#37
Yes, using RDF+SPARQL I would use it any day of the week. The power off RDF comes when having to deal with other peoples data, or providing your data to other people. This is not a usecase everyone has but if you do nothing beats RDF+SPARQL in a financial sense.

The variety of DBs available if you use RDF is great as well. Different DBs have different strong sides but we can keep the same data model and query language.

Re: Ask HN: If you've used a graph database, would you use it again?

#38

I started using Neo4j 8 years ago after a long time as a relational database developer. I needed it for a project building a LinkedIn clone with skills (at the time LinkedIn didn't have skills). I was going to need a massive join table of user-skill-user and decided it was best in a graph. I built a ruby gem "neography" as a Neo4j driver and became an open source contributor. Later Neo4j contracted me to build a rule…

How is a graph database built under the hood? I know that a decent RDBMS (simplified) will consist of the following: - data in blocks organised with a block-size that the underlying filesystem likes - a cache for the most frequently used blocks - every index is a B-Tree with pointers to the blocks containing the tuples Then there are column stores as well as row stores, and for compression you might have some diction…

A graph database is similar, only it uses direct-record-ids for linking connected entities and not indexes. So instead of doing joins on indexes it follows record-pointers during graph traversals.

In the graph databases book (graphdatabases.com) there is a chapter on the internal architecture of Neo4j.

Re: Ask HN: If you've used a graph database, would you use it again?

#39

I started using Neo4j 8 years ago after a long time as a relational database developer. I needed it for a project building a LinkedIn clone with skills (at the time LinkedIn didn't have skills). I was going to need a massive join table of user-skill-user and decided it was best in a graph. I built a ruby gem "neography" as a Neo4j driver and became an open source contributor. Later Neo4j contracted me to build a rule…

How is a graph database built under the hood? I know that a decent RDBMS (simplified) will consist of the following: - data in blocks organised with a block-size that the underlying filesystem likes - a cache for the most frequently used blocks - every index is a B-Tree with pointers to the blocks containing the tuples Then there are column stores as well as row stores, and for compression you might have some diction…

Graph databases are built a lot of different ways; for example Neo4j's architecture is very, very different than something like an RDF triple store, or datastax on top of cassandra.

[Neo4j internals can be seen here](https://www.slideshare.net/thobe/an-overview-of-neo4j-intern...)...it's a bit old but I think mostly still accurate.

In graphs you have to persist nodes and edges, though you may partition nodes by label/category. In the case of neo4j there is a property store rather than a set of columns.

Re: Ask HN: If you've used a graph database, would you use it again?

#40
post #23
post #4

The coolest thing to me about neo4j is that it spins up a little web server with an extremely friendly UI that allows people to build queries and run then locally. My non-coder coworker wrote all her own queries and found, then fixed errors in the data entirely on her own. Our data set could have been handled fine with a relational database, honestly. However this was a rare case where over-engineering a problem and…

So I used Neo4j in 2011. It was very exciting at first, and then I got quite burned by it when I tried to make something real. Many people in this thread are describing a very different experience, and I want to know if it has really dramatically improved, or if the use cases of Neo4j users are just different from mine. - In 2011, it worked great on small data that fit in RAM, but once the data became bigger than RAM…

It runs authenticated enabled by default and uses https and also our binary (always-TLS) protocol.

Every database benefits from having the _hot_ dataset in memory, so that's the same with Neo4j.

2011 was many years ago, since then the memory management has been completely rewritten. You very probably wouldn't use the Neo4j Browser in production as it is meant to be a developer tool. Usually, you would build an app that uses the drivers to connect to the db.

Post reply on HN