3 ms·
How are JSON operations not atomic? Genuinely curious
by mulmboy 3y ago
How are JSON operations not atomic? Genuinely curious
- bandrami 3y agoI think the sense is not "atomic by field" or whatever you'd call that. If you're going to ignore the fact that PG is an actual ORDB and just store gigantic blobs of JSON in it, it will write the entire object whenever you update part of it, because the whole point is you're supposed to store it as a multi-field record.
- SonOfLilit 3y agoIsn't that true for Mongo as well?
- rb12345 3y agoYes, but as MongoDB is a document database, storing and updating giant blobs of JSON as a single operation as opposed to breaking the JSON down into individual fields is intended behaviour. This works in Postgres too, of course, but then you lose the relational database advantages on top of the large-single-field issues. All this really comes down to is picking the right database type for the problem you're trying to solve.
- winrid 3y agoI answered here: https://news.ycombinator.com/item?id=39865835 https://news.ycombinator.com/item?id=39865835