For a many to many relationship is it better to use relational database or nosql?

后端 未结 2 356
悲&欢浪女
悲&欢浪女 2021-01-28 04:25

For a many to many relationship is it better to use relational database or nosql?

Let\'s assume you have a bunch of users. And each user can have friends that are from t

2条回答
  •  天涯浪人
    2021-01-28 04:52

    It does seem more intuitive to the untrained. That's why the network data model is still so prevalent even though the relational model has been around for decades.

    "Better" depends on how you want to use it, and "more efficient" depends on the database engine, indexes and various other factors. I prefer the relational model since I can formulate any reasonable question that can be logically derived from the data and get a correct answer. For example, if I wanted to find friends of friends, I could join a relational many-to-many table with itself. I could find cycles and cliques of any particular size. I could easily declare a unique constraint on pairs of friends.

    It's possible to do these things without a relational database but I doubt it would be as easy or concise.

    The particular data structure used by the database engine has nothing to do with the relational concept, though it is relevant to efficiency. For more info on which data structure would be used, you'll need to look at particular database management systems and their storage engines.

提交回复
热议问题