public inbox for pgsql-performance@postgresql.org
help / color / mirror / Atom feedFrom: Rick Otten <rottenwindfish@gmail.com>
To: Kristjan Mustkivi <sonicmonkey@gmail.com>
Cc: James Pang <jamespang886@gmail.com>
Cc: pgsql-performance@lists.postgresql.org
Subject: Re: table bloat very fast and free space can not be reused
Date: Mon, 20 Apr 2026 10:39:24 -0400
Message-ID: <CAMAYy4JzAuDNLAy-k=ZgELT8VwvcBUhVrxgfM9vA1qJqzB9usQ@mail.gmail.com> (raw)
In-Reply-To: <CAOQPKatQ0NCP5vDCZ_pz_JQkyM+AP=nPL5wPY3awWVoZXA4T1A@mail.gmail.com>
References: <CAHgTRff=eH1GwVb=ENMzX6hBEajdTccCQbeVRkj4OtYLm69a9g@mail.gmail.com>
<CAOQPKatQ0NCP5vDCZ_pz_JQkyM+AP=nPL5wPY3awWVoZXA4T1A@mail.gmail.com>
On Sun, Apr 19, 2026 at 7:44 AM Kristjan Mustkivi <sonicmonkey@gmail.com>
wrote:
> On Sun, Apr 19, 2026 at 4:28 AM James Pang <jamespang886@gmail.com> wrote:
> >
> > experts:
> > source database v14 , pglogical extension 2.4.5 replication to new
> 17, source table very frequent UPDATEs /DELETES /INSERTS and has two text
> and jsonb. in source database, application update/delete/insert through
> SQL, table size did not increased quickly. but in target pg v17 , by
> pglogical apply, we found table increased very quickly , table size got
> doubled in days.
> > Vacuum analyze did not help , only vacuum full can help. pgstattuple
> show most of space are free space , that much more than source. it looks
> like these replicate DML always asking new pages instead of reuse existing
> freespace.
>
> Hi,
>
> We have had the exact same problem in the past - a large json column
> getting very frequent updates (hundreds even thousand per minute) on
> the source and the replica side table bloating up. No amount of tuning
> attempts made any difference (conversion of json to text, different
> table specific autovacuum settings etc). Eventually, the table was
> taken out of the replication and later on made UNLOGGED which also
> freed up a giant swathes of storage from WAL written. Such design was
> then called an antipattern and has not been allowed since.
>
Which design is an antipattern? Using json for volatile data sets or
unlogging the table?
Does `pg_repack` help? I know it probably isn't practical to run it every
couple of days. It also can sometimes causes headaches when repacking a
table with a ton of logical replication activity, but it might be a tool to
consider if you haven't already. If you can partition the table with the
crazy amount of json changes, you don't have to repack all the partitions,
you might be able to repack just the older ones with the worst bloat.
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 using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: rottenwindfish@gmail.com, sonicmonkey@gmail.com, jamespang886@gmail.com, pgsql-performance@lists.postgresql.org
Subject: Re: table bloat very fast and free space can not be reused
In-Reply-To: <CAMAYy4JzAuDNLAy-k=ZgELT8VwvcBUhVrxgfM9vA1qJqzB9usQ@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox