4

I have a client who understands that his data model is a directed acyclic graph. We've been working with collections of nodes and an intermediate table of edges, and the performance has been pretty good. We have less than 100,000 data nodes in the current implementation, although that may grow by one or two orders of magnitude. He's recently become convinced that, since we have a graph, a graph database (like Neo4J or Titan) would be "better."

What problems does a graph-oriented database actually solve that cannot be solved with SQL, or that requires much more heavy lifting from the SQL client? From what I can see, path discovery appears to be it, but that can't be the whole story.

1
  • 2
    I believe it's not the "number of nodes" so much as a "depth of traversal" required for various queries. Of course there are relational database approaches like Nested Set and Hierarchical IDs and Connects, but these are often designed to work with Trees and not necessarily less-restrictive DAGs. Of course, since the post hints at separate node/edge tables, I suspect DAGs are already being used - which then goes back to traversal depth.
    – user166390
    Commented Nov 20, 2012 at 21:30

3 Answers 3

1

In a relational database, nodes and edges will be related by some value they have in common. Searching for a node or edge will generally involve querying an index for this value.

In a graph database, nodes and edges are related directly by the same sort of internal database structures a relational database uses to maintain the internal structure of an index. So finding an edge from a node or a node from an edge is more like going one level deep in a relational index regardless of the number of nodes; while if you have millions of nodes in a relational database the index would be several levels deep.

0

actually its true, just Like mongo has "geo spacial" database features built in, so it doesnt have to process as much as if you wanted to do it with mysql. The two databases you mentioned (ive worked with titan) are just better for graphing and it wont be so harsh on your php or db statements.

0

In short, don't fix it if it's not broken. If the advantage is not clear to you or your client, just weight the cost of migrating against this unclear benefit of a graph database.

Having no experience with the aforementioned graph databases, I can only assume that what you could gain from databases like that is faster development as your database will be a better fit for the type of data that you have. I have been working with MongoDB a lot and the cherry on the cake for me has been development speed due to the simplicity of querying/writing to the database, followed by much richer document structures without having to define any schemas. You also get some amazing features like super simple replication, automatic failover, automatic sharding etc but in your case with just 100k documents you are not likely to think about this kind of problems any time soon. All the mainstream relational databases can run on a small server and perform well with that amount of docs.

Not the answer you're looking for? Browse other questions tagged or ask your own question.