4 ms·
Isn't this the case for postgresql data in general? ie, on updates, new data rows are written containing all the field values, whether or not they have changed
by roller 13y ago
Isn't this the case for postgresql data in general? ie, on updates, new data rows are written containing all the field values, whether or not they have changed.
- arethuza 13y agoIt's more they case that when you want to reach into an existing stored document and change a single value you have to re-write the entire document from your application. On the reading side there are functions and operators that allow you to reach into stored JSON and extract the parts you want. What would be nice would be to be able to do something similar for updates - although this is clearly more complex than reading, so I can see why it has been done this way. Edit: I guess the most general solution would be to directly support something like JSON Patch: https://tools.ietf.org/html/rfc6902 https://tools.ietf.org/html/rfc6902
- deleted 13y ago[deleted]
- joevandyk 13y agoYes, but you don't have to specify all the other columns that aren't being updated. With json/jsonb, you have to provide the entire object graph each time you are updating it. You can't update one field in the graph. Which could be a pain if you have concurrent updates. Hopefully we'll be able to update parts of the jsonb columns sometime.
- ants_a 13y agoYou can do it right now, you just need to write your own updating function. With PL/Python or PL/V8 it would be quite simple.
- Tobu 13y agoYou're right, because MVCC works on immutable rows. The structure can be broken up to accommodate large values[1], which saves updating parts that don't change, but json data is a single column and updates need to copy the entire document. [1] http://www.postgresql.org/docs/devel/static/storage-toast.html http://www.postgresql.org/docs/devel/static/storage-toast.ht...