Would a model like this translate well to a document or graph database?

Posted by Eric on Programmers See other posts from Programmers or by Eric
Published on 2013-10-18T14:50:59Z Indexed on 2013/10/18 16:11 UTC
Read the original article Hit count: 271

I'm trying to understand what types of models that I have traditionally persisted relationally would translate well to some kind of NoSQL database. Suppose I have a model with the following relationships:

Product  1-----0..N  Order
Customer 1-----0..N  Order

And suppose I need to frequently query things like All Orders, All Products, All Customers, All Orders for Given Customer, All Orders for Given Product. My feeling is that this kind of model would not denormalize cleanly - If I had Product and Customer documents with embedded Orders, both documents would have duplicate orders.

So I think I'd need separate documents for all three entities. Does a characteristic like this typically indicate that a document database is not well suited for a given model? Generally speaking, would a document database perform as well as a relational database in this kind of situation?

I know very little about graph databases, but I understand that a graph database handles relationships more performantly than a document database - would a graph database be suited for this kind of model?

© Programmers or respective owner

Related posts about database

Related posts about nosql