Transactions in NoSQL?

前端 未结 11 982
长情又很酷
长情又很酷 2020-12-22 18:39

I\'m looking into NoSQL for scaling alternatives to a database. What do I do if I want transaction-based things that are sensitive to these kind of things?

11条回答
  •  旧巷少年郎
    2020-12-22 19:26

    Just wanted to comment to money transaction advice on this thread. Transactions are something you really want to use with money transfers.

    The example given how do que the transfers is very nice and tidy.

    But in real life transferring money may include fees or payments to other accounts. People get bonuses for using certain cards that come from another account or they may get fees taken from their account to another account in same system. The fees or payments can vary by financial transaction and you may need to keep up bookkeeping system that shows credit and debit of each transaction as it comes.

    This means you want to update more than one row same time since credit on one account can be debit on one or more accounts. First you lock the rows so nothing can change before update then you make sure data written is consistent with the transaction.

    That's why you really want to use transactions. If anything goes wrong writing to one row you can rollback whole bunch of updates without the financial transaction data ending inconsistent.

提交回复
热议问题