3 ms·
Can you please expand on the JSONB unpredictable behavior? We are about to embark on a journey to move some of our data from MongoDB to postgres (with some JSON
by throwaway7783 2y ago
Can you please expand on the JSONB unpredictable behavior? We are about to embark on a journey to move some of our data from MongoDB to postgres (with some JSONB). While we don't have significant concurrent writes to a table, would be very helpful to understand the issues
- 999900000999 2y agohttps://github.com/shrinerb/shrine/discussions/665 https://github.com/shrinerb/shrine/discussions/665 I've never personally encountered this, but I've seen other HN contributors mention it. https://news.ycombinator.com/item?id=43189535 https://news.ycombinator.com/item?id=43189535 From what I can tell, unlike mongo, some postgres queries will try to update the entire JSONB data object vs a single field. This can lead to race conditions.
- throwaway7783 2y agoAh, thanks. The first link seems something specific to Shrine. The bottomline is concurrent updates to different parts of JSONB need row level locking for correct behavior in Postgresql. This is not an important issue for us. Thank you for the pointers
- ahoka 2y agoYou can trivially do it without locking using a version column.
- leonidasv 2y agoYou may be interested in FerretDB[1]. [1] https://www.ferretdb.com/ https://www.ferretdb.com/