Re: [GENERAL] Insert performance and disk usage in JSON vs JSONB - Mailing list pgsql-general

From Merlin Moncure
Subject Re: [GENERAL] Insert performance and disk usage in JSON vs JSONB
Date
Msg-id CAHyXU0wYwF7s_UnSYMPN1Wv3yjrKnJS+-i15ZqhP3SEzJU0vzg@mail.gmail.com
Whole thread Raw
In response to [GENERAL] Insert performance and disk usage in JSON vs JSONB  (Ronny Abraham <rabraham@kns.com>)
List pgsql-general
On Mon, May 15, 2017 at 12:02 PM, Ronny Abraham <rabraham@kns.com> wrote:
> 4. Insert 10,000 rows to JSON, execution time (sec):
> 5. Insert 10,000 rows to JSONB, execution time (sec):
>
> What’s interesting is that inserting to JSONB is slightly faster than
> inserting to JSON.

With those times, only explanation is that you are bottlenecked by
storage fsync time.  If storage is fast, you should be able to do 10k
inserts per second+ for either type unless the documents are large.

For storing documents, you should only consider using the json type if
the exact structure of the originating document is important for the
most part.  For querying and manipulation it's better and faster
(mostly) and the API is more robust.

The json type has other uses; mainly for serialization from non-json
data but that's not a storage consideration.

merlin


pgsql-general by date:

Previous
From: Devrim Gündüz
Date:
Subject: Re: [GENERAL] Help: Installing 9.6 breaks local connections to 9.2on Centos 6.9
Next
From: Thomas Kellerer
Date:
Subject: Re: [GENERAL] Insert performance and disk usage in JSON vs JSONB