Re: performance considerations of jsonb vs separate rows

From: Dmitry Dolgov <9erthalion6(at)gmail(dot)com>
To: Rob Nikander <rob(dot)nikander(at)gmail(dot)com>
Cc: Postgres General <pgsql-general(at)postgresql(dot)org>
Subject: Re: performance considerations of jsonb vs separate rows
Date: 2017-06-19 19:52:54
Message-ID: CA+q6zcXpaNXDQ2Oo3dW=mztwS6Q6BcFzwaBnygLJ-FYDCKBJaA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> On 19 June 2017 at 21:29, Rob Nikander <rob(dot)nikander(at)gmail(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Dmitry O Litvintsev 2017-06-19 19:53:55 Re: autovacuum holds exclusive lock on table preventing it from to be updated
Previous Message Andreas Kretschmer 2017-06-19 19:51:46 Re: performance considerations of jsonb vs separate rows