by api · 9y ago · 0 comments
Pros:
- Very easy and robust clustering (Raft-based, automatic fail-over). This is huge for us.
- Streaming change feeds. This one is also huge. Makes any kind of real-time, reactive, or event driven programming very easy and IMHO is something that should exist in every database.
- It's kind of half SQL. It's a NoSQL document store but encourages a relational design and supports many relational queries.
- Rational and pretty easy to understand query language. It's much cleaner than Mongo.
- Easy to deploy and configure.
- It passed the Jepsen tests before Mongo did and overall has a solid history of not losing data.
Cons:
- It's a CPU hog, at least when compared with PostgreSQL.
- It's also an I/O hog, though we sponsored some improvements that are getting merged in the next version that will reduce this and also make table commit a configurable parameter. You'll be able to have fully and partially (long flush delay) in-memory tables for highly ephemeral data.
For example, instead of applying a bank account transfer as a database transaction that debits one account record and credits another, you create a new transaction record (account transaction, not database transaction.) Then account balances are a sum over these transaction records.
They all have various support for transactions with relational usually the most comprehensive.
What do you use that for?
For example, you might store data with minute level granularity for the past 24 hours but only hourly for the past 30 days. If someone queries the past two days, you need to look at both those datasets. Then, every hour or so, you need to summarize an hour of minute level data, insert it into the hourly granularity table and then remove it from the minute granularity table. Meanwhile, you want to make sure any queries aren't going to double count that data after insertion but before removal.
This can be done without transactions in a few ways, but they require putting your replication and rollup logic and constraints into your reading code, rather than having it isolated to your roll up code. And your data model has to be tweaked to allow for some of these operations. And the complexity often results in double counting bugs (or bugs where the data is not counted at all).
There are solutions though. They just require a lot more hoops than starting a transaction, moving the data, committing the transaction.