Re: Insert performance and disk usage in JSON vs JSONB

From: Ronny Abraham <rabraham(at)kns(dot)com>
To: Dmitry Dolgov <9erthalion6(at)gmail(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Insert performance and disk usage in JSON vs JSONB
Date: 2017-05-15 20:39:19
Message-ID: feb55601b7c544819926a5fc27dfd57f@USEPRDEX1.corp.kns.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Thank you, I updated my test to insert 10,000 rows where each row has a JSON or JSONB with 100 keys (I do not have a use case of 1000), here are the results:

7. Insert 10,000 rows to JSON (100 items in each row), execution time (sec):
119.411994457

8. Insert 10,000 rows to JSONB (100 items in each row), execution time (sec):
118.248999119

Thanks
Ronny

From: Dmitry Dolgov [mailto:9erthalion6(at)gmail(dot)com]
Sent: Monday, May 15, 2017 3:35 PM
To: Ronny Abraham
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: [GENERAL] Insert performance and disk usage in JSON vs JSONB

On 15 May 2017 at 19:25, Ronny Abraham <rabraham(at)kns(dot)com<mailto:rabraham(at)kns(dot)com>> wrote:
>
> What’s interesting is that inserting to JSONB is slightly faster than inserting to JSON.
>
> Maybe that’s because my JSON has a flat structure (no nesting), or maybe I am doing something else wrong?

I assume it's because your json documents (10 fields) are not big enough. If you'll try the same tests
with something like 1000 keys for each document, there should be noticeable difference (at least in my
case it was like that).

________________________________

This email is non-binding, is subject to contract, and neither Kulicke and Soffa Industries, Inc. nor its subsidiaries (each and collectively “K&S”) shall have any obligation to you to consummate the transactions herein or to enter into any agreement, other than in accordance with the terms and conditions of a definitive agreement if and when negotiated, finalized and executed between the parties. This email and all its contents are protected by International and United States copyright laws. Any reproduction or use of all or any part of this email without the express written consent of K&S is prohibited.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Ken Tanzer 2017-05-15 20:40:00 Re: Help: Installing 9.6 breaks local connections to 9.2 on Centos 6.9
Previous Message Tom Lane 2017-05-15 20:34:14 Re: Help: Installing 9.6 breaks local connections to 9.2 on Centos 6.9