pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Adrian Klaver <adrian.klaver@aklaver.com>
To: Volkan Unsal <spocksplanet@gmail.com>
Cc: pgsql-general <pgsql-general@postgresql.org>
Subject: Re: Removing a key from jsonb is sloooow
Date: Wed, 17 Jul 2019 08:01:02 -0700
Message-ID: <3221c9b7-e954-6088-aaba-f77b153f4ca8@aklaver.com> (raw)
In-Reply-To: <CAMcqKm=zFfVPUwou=TtMmtJi1eFTg_Qm6-ck1VxACX=FQ1FTdw@mail.gmail.com>
References: <CAMcqKmnaJS_xnuKY6j2e+uZbHXhrtDx6SaDcRp-ZMYPfAbsOKw@mail.gmail.com>
	<553286cb-47f5-bf94-42f2-12d1f489fbdf@aklaver.com>
	<CAMcqKm=zFfVPUwou=TtMmtJi1eFTg_Qm6-ck1VxACX=FQ1FTdw@mail.gmail.com>

On 7/17/19 7:58 AM, Volkan Unsal wrote:

Please post to list also.
Ccing list
> @Adrian
> 
> More information about my setup:
> 
> Postgres version:
> PostgreSQL 10.9 (Debian 10.9-1.pgdg90+1) on x86_64-pc-linux-gnu, 
> compiled by gcc (Debian 6.3.0-18+deb9u1) 6.3.0 20170516, 64-bit
> 
> Table schema:
> CREATE TABLE public.projects (
>     misc jsonb DEFAULT '{}'::jsonb NOT NULL
> );
> 
> Explain analyze:
> explain analyze update projects set misc = misc - 'foo';
> 
> Update on projects  (cost=0.00..4240.93 rows=10314 width=1149) (actual 
> time=346318.291..346318.295 rows=0 loops=1)
>    ->  Seq Scan on projects  (cost=0.00..4240.93 rows=10314 width=1149) 
> (actual time=1.011..266.435 rows=10314 loops=1)
> Planning time: 40.087 ms
> Trigger trigger_populate_tsv_body_on_projects: time=341202.492 calls=10314
> Execution time: 346320.260 ms
> 
> Time: 345969.035 ms (05:45.969)
> 
> 
> 
> On Wed, Jul 17, 2019 at 10:39 AM Adrian Klaver 
> <adrian.klaver@aklaver.com <mailto:adrian.klaver@aklaver.com>> wrote:
> 
>     On 7/17/19 7:30 AM, Volkan Unsal wrote:
>      > I'm trying to remove a key from a jsonb column in a table with
>     10K rows,
>      > and the performance is abysmal. When the key is missing, it takes 5
>      > minutes. When the key is present, it takes even longer.
>      >
>      > Test with non-existent key:
>      >
>      >  >> update projects set misc = misc - 'foo';
>      > Time: 324711.960 ms (05:24.712)
>      >
>      > What can I do to improve this?
> 
>     Provide some useful information:
> 
>     1) Postgres version
> 
>     2) Table schema
> 
>     3) Explain analyze of query
> 
> 
> 
>     -- 
>     Adrian Klaver
>     adrian.klaver@aklaver.com <mailto:adrian.klaver@aklaver.com>
> 
> 
> 
> -- 
> *Volkan Unsal*
> /Product Engineer/
> volkanunsal.com <http://volkanunsal.com;


-- 
Adrian Klaver
adrian.klaver@aklaver.com





view thread (7+ messages)  latest in thread

Message-ID: <3221c9b7-e954-6088-aaba-f77b153f4ca8@aklaver.com>
Permalink:  ../3221c9b7-e954-6088-aaba-f77b153f4ca8@aklaver.com/
Also on:    postgresql.org/message-id/3221c9b7-e954-6088-aaba-f77b153f4ca8@aklaver.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: adrian.klaver@aklaver.com, spocksplanet@gmail.com
  Subject: Re: Removing a key from jsonb is sloooow
  In-Reply-To: <3221c9b7-e954-6088-aaba-f77b153f4ca8@aklaver.com>
  References: <CAMcqKmnaJS_xnuKY6j2e+uZbHXhrtDx6SaDcRp-ZMYPfAbsOKw@mail.gmail.com> <553286cb-47f5-bf94-42f2-12d1f489fbdf@aklaver.com> <CAMcqKm=zFfVPUwou=TtMmtJi1eFTg_Qm6-ck1VxACX=FQ1FTdw@mail.gmail.com> <3221c9b7-e954-6088-aaba-f77b153f4ca8@aklaver.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox