What's read-before-write in NoSQL?

六月ゝ 毕业季﹏ 提交于 2019-12-07 06:22:37

问题


I read in a book : "Cassandra is an NoSQL database and promotes read-before-write instead of relational model".

What does "read-before-write" means in a NoSQL context?


回答1:


Read before write means that you are checking the value of a cell before modifying it.

Read-Before write is a huge anti-pattern in Cassandra. Any book you read that encourages doing this should be looked at with suspicion. Normally Cassandra writes are performed without having any information about the current state of the database. One of the side effects of this is that all writes to Cassandra are actually update operations. This is allows for extremely fast writes but does have some limitations.

If you really need to check the state of the database before writing, Cassandra provides "Check and Set"(CAS) operations which use PAXOS to establish database state prior to modifying the record. These are written like update table set x = 3 if y = 1. CAS queries are orders of magnitude slower than a normal write in C* and should be used sparingly.



来源:https://stackoverflow.com/questions/28763627/whats-read-before-write-in-nosql

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!