Re: [GENERAL] performance considerations of jsonb vs separate rows - Mailing list pgsql-general

From Dmitry Dolgov
Subject Re: [GENERAL] performance considerations of jsonb vs separate rows
Date
Msg-id CA+q6zcXpaNXDQ2Oo3dW=mztwS6Q6BcFzwaBnygLJ-FYDCKBJaA@mail.gmail.com
Whole thread Raw
In response to [GENERAL] performance considerations of jsonb vs separate rows  (Rob Nikander <rob.nikander@gmail.com>)
List pgsql-general
> On 19 June 2017 at 21:29, Rob Nikander <rob.nikander@gmail.com> wrote:
>
> I'm wondering about the tradeoffs, specifically: is it possible to update one piece of a jsonb value without having to rewrite the entire field? There are cases where that data field was getting pretty big (500kb). Would you expect any obvious performance differences between these two options?

Unfortunately no, an entire jsonb field has to be written back even if you've touched only one key.
From my own benchmarks it looks like you'll scarcely notice this (e.g. in comparison with MongoDB) only if you work
with small enough documents (about 2kb), and everything above this limit more or less seriously hit the performance.
You can take a look at this presentation [1] from Oleg Bartunov, it contains results of some benchmarks (from slide 44).

[1]: http://www.sai.msu.su/~megera/postgres/talks/jsonb-pgconf.us-2017.pdf

pgsql-general by date:

Previous
From: Andreas Kretschmer
Date:
Subject: Re: [GENERAL] performance considerations of jsonb vs separate rows
Next
From: Dmitry O Litvintsev
Date:
Subject: Re: [GENERAL] autovacuum holds exclusive lock on table preventing itfrom to be updated