"Partial Object Updates" will be an Important NoSQL Feature
It’s nice that in SQL we can do things like
UPDATE PERSONS SET X = X + 1
We term this a “partial object update”: we updated the value of X without sending a full row update to the server.
Seems like a very simple thing to be discussing, yet some nosql solutions do not support this (others do).
In these new datastores, the average stored object size (whether it be a document, a key/value blob, or a row) tends to be larger than the traditional database row. The data is not fully normalized, so we are packing more data into a single storage object than before.
This means the cost of full updates is higher. If we have a 100KB document and want to set a single value within it, passing the full 100KB in both directions over the network for the operation is expensive.
MongoDB supports partial updates in its update operation via a set of special $ operators: $inc, $set, $push, etc. More of these operators will be added in the future.
There are further benefits to the technique too. First, we get easy (single document) atomicity for these operations (consider $inc). Second, replication is made cheaper: when a partial update occurs, MongoDB replicates the partial update rather than the full object changed. This makes replication much less expensive and network intensive.
1 week ago
