What makes Cassandra (and NoSQL in general) a better solution to an RDBMS?

前端 未结 11 2022
醉梦人生
醉梦人生 2021-02-02 12:00

Well, NoSQL is a buzzword right now so I\'ve been looking into it. I\'m yet to get my head around ColumnFamilies and SuperColumns, etc... But I have been looking at how the data

相关标签:
11条回答
  • 2021-02-02 12:16

    RDBMS' are all about consistency. They do a great job on data that gets churned alot with transactions. See also ACID (atomicity, consistency, isolation, durability). Sometimes you don't need all that, like when storing data from logs or working on data that's not going to change, just accumulate.

    NoSQL databases let you relax the requirements for transactions and get better performance (as well as scale to large distributed storage silos easier).

    0 讨论(0)
  • 2021-02-02 12:18

    I guess what I'm asking is "when should I choose NoSQL over RDBMS?"

    [Caveat: I've never read about NoSQL before]

    According to Wikipedia, NoSQL isn't good at joins: which implies (to me) no referential integrity and no normalization.

    0 讨论(0)
  • 2021-02-02 12:20

    Answer is easy. If you need data storage - use NoSQL, if you need more features then just storing data - use RDBMS.

    0 讨论(0)
  • 2021-02-02 12:21

    If you are google, then you might be in a position where a NoSQL would be easier on you than a RDBMS. Since you are not, the many advantages an RDBMS provides you will probably be of some use. Significantly, on a single node, NoSQL offers absolutely no advantages over RDBMSes. RDBMSes offer lots of advantages over NoSQL, though. what are they?

    RDBMSes use some pretty deep magic to understand the data it owns, and the data you are asking for, in such a way that it can return that data in the most efficient manner possible. If you didn't ask about some column, the rdbms doesn't waste any effort retrieving it. If you are interested in rows that have fields in common across two tables, (this is a join, btw), the RDBMS doesn't have to check every single pair of rows for matches, or what a NoSQL db usually does is just give you everything and make you do the checking. with a RDBMS, you can usually construct queries that are actually 'about' the data you are using, like "if the date is a tuesday", and if your indexes support it (if you do that query alot then you would add such an index) you can get those rows efficiently.

    There is another reason why RDBMSes are nice. Transactions are easy on RDBMSes, but are much harder to get right on NoSQL databases. Supposing you are implementing a blogging engine. Suppose the post title (which appears in the URL) needs to be unique across all posts. In an RDBMS, you can easily be sure that you won't get this wrong accidentally. With a NoSQL database, if it does support some kind of transactional integrity, it's usually at the shard level, anything that could possibly require that kind of integrity must be on the same shard. since any pair of users could possibly be posting at the same moment, then every users' post must be on the same shard to get the same effect. Well, then you don't get any benefit at all from NoSQL.

    0 讨论(0)
  • 2021-02-02 12:23

    NoSQl databases are fine for some websites where you don't need transaction or consistency where all you are doing is presenting some data (but until you get really really large, they are not really very needed).

    But if you need to enforce financial rules (or other complex data integrity rules) or internal controls or reporting and aggregating data for reporting, you need an RDBMS. I'll bet even Google uses RDBMS' for their own HR and financial data, etc.

    For some web applications, you might even want a combination of both, the nosql database for some types of information, the transactional relational database for orders and other things where transactional consistency is a must.

    If you develop web sites, I think you need to thoroughly understand both types of databases and the needs behind them before choosing how to handle any new functionality.

    It seems to me that you have almost no knowledge of relational databases and would rather do what is easier for you personally than what is right for the project. Maybe I'm not reading that correctly, but anyone who never uses joins is suspect in terms of understanding relational databases.

    You don't decide between these two based on which one seems easier to understand or which is the buzzword of the month, you decide them based on the functionality you will need, not just for the user interface but for administrative tasks, reporting, financial or other types of data auditing, government regulation, data recovery in case of a hardware failure, etc.

    0 讨论(0)
  • 2021-02-02 12:24

    The simplest answer I can think of is: When your data doesn't fit a relational model.

    0 讨论(0)
提交回复
热议问题