Re: Updating jsonb rows

From: Michael Moore <michaeljmoore(at)gmail(dot)com>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: postgres list <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Updating jsonb rows
Date: 2017-08-14 20:51:32
Message-ID: CACpWLjOPf997rUy0w2y+hi75_Fy3HcQ9RwwWBXcLmrAyBG4ccw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Here are some final result timings on Temp Tables vs JSONB. _25_sec means
.25 seconds. This is the result of ~2,300 executions of my function using
various input parameters.
[image: Inline image 1]

Basically what it shows is that even though the average response time for
Temp Tables is superior, JSONB wins in consistency. The Temp Tables
approach has some horrible outliers.

The max response time for Temp Tables was over 10.8 seconds, while the max
for JSONB was 1.2 seconds.

Obviously, nobody should make any generalizations from my very specific
results, but if you need to get off of Temp Tables, going to JSONB is worth
considering.

Mike

On Mon, Aug 14, 2017 at 12:33 PM, Michael Moore <michaeljmoore(at)gmail(dot)com>
wrote:

> Probably the solution is "don't try to use JSON as temp tables for
> anything but very small datasets". As you know, I'm converting an
> application that uses temp tables to NOT use temp tables because it needs
> to run in a read-only database. JSONB seemed to be the way to go because
> you can almost treat them the same as temp tables. I think in the end, it
> will be "fast enough", but just not as fast as temp tables. Thanks for your
> help!
> Mike
>
>
> On Mon, Aug 14, 2017 at 11:12 AM, David G. Johnston <
> david(dot)g(dot)johnston(at)gmail(dot)com> wrote:
>
>> On Mon, Aug 14, 2017 at 10:35 AM, Michael Moore <michaeljmoore(at)gmail(dot)com>
>> wrote:
>>
>>> Basically what I am doing is trying to simulate a SQL UPDATE statement.
>>> currently I am doing this, and* it works, but it is slow*, so I am
>>> looking for a better way.
>>>
>>
>> ​I don't presently know a better solution in PostgreSQL.
>>
>> Dave
>> ​
>>
>
>

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Campbell, Lance 2017-08-23 18:03:39 how many times
Previous Message Michael Moore 2017-08-14 19:33:18 Re: Updating jsonb rows