Re: Append only tables

From: Kurt Roeckx <kurt(at)roeckx(dot)be>
To: Rui DeSousa <rui(at)crazybean(dot)net>
Cc: pgsql-admin(at)lists(dot)postgresql(dot)org
Subject: Re: Append only tables
Date: 2020-03-21 08:30:44
Message-ID: 20200321083044.GI22330@roeckx.be
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On Sat, Mar 21, 2020 at 01:44:47AM -0400, Rui DeSousa wrote:
>
>
> > On Mar 20, 2020, at 5:50 PM, Kurt Roeckx <kurt(at)roeckx(dot)be> wrote:
> >
> > Hi,
> >
> > I have a few tables that are append only. Thre are only gets insert
> > and select queries, never update or delete.
> >
> > What I see is that every file is still being updated. It's
> > currently about 500 GB big, and every of that almost 500 files has
> > been touched the past 24 hours.
> >
> > (auto) vacuum is not happening on the table.
> >
>
> Vacuum is still required as the tuples need to be frozen. Have you vacuumed the table?

I did not manually vacuum them, nor did auto vacuum ever get
triggered, at least not according to what is in
pg_stat_user_tables;

> It could be the result of records being frozen during selects statements; select can freeze tuples that meet the criteria for being frozen.

I guess it's doing that now. iotop shows:
TID PRIO USER DISK READ> DISK WRITE SWAPIN IO COMMAND
10227 be/4 postgres 67.68 G 67.56 G 0.00 % 79.66 % postgres: 12/main: kurt certs [local] VACUUM

> I would recommend vacuuming the table to get the existing records frozen; then I believe you should see fewer updates to the all the base files.

If this is needed, why doesn't autovacuum do this for me? Or do I
need to modify some parameters so that autovacuum does get
triggered?

I actually didn't run any select query on that table yet, it's
still importing the data. Can an insert also trigger the freeze?

Anyway, the vacuum is running, I will let you know if it helps or
not.

Kurt

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Wim Bertels 2020-03-21 12:52:12 Re: Append only tables
Previous Message Rui DeSousa 2020-03-21 05:44:47 Re: Append only tables