Re: How does vacuum full works if table is partitioned?

From: Vijaykumar Jain <vijaykumarjain(dot)github(at)gmail(dot)com>
To: kaido vaikla <kaido(dot)vaikla(at)gmail(dot)com>
Cc: Pgsql-admin <pgsql-admin(at)lists(dot)postgresql(dot)org>
Subject: Re: How does vacuum full works if table is partitioned?
Date: 2021-06-17 14:09:11
Message-ID: CAM+6J94fc7ars0hOHUGVeBP1d4487qFVXg1iCA1hD7ORxa-5Nw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On Thu, 17 Jun 2021 at 15:17, kaido vaikla <kaido(dot)vaikla(at)gmail(dot)com> wrote:
>
> Hi,
>
> But my question was did you check, if t1 and/or t2 relfile was deleted before complete vacuum?
> Why I had, in my example, temporarily 335 files extra (old relfiles?). And removed after vacuum completely finished.

for me it is mostly the partitions and its indexes and some metadata
relates to those tables.

how i check that.
create table before__vacuum as select oid, relname,
relfilenode,reltablespace from pg_class order by oid;
vacuum full t;
create table after__vacuum as select oid, relname,
relfilenode,reltablespace from pg_class order by oid;

and then check relfilenode that do not exist in the db after full vacuum,

select b.* from before__vacuum b where not exists ( select 1 from
after__vacuum a where b.relfilenode = a.relfilenode) order by oid;
oid | relname | relfilenode | reltablespace
-------+---------+-------------+---------------
26497 | t0 | 26497 | 0
26500 | t0_pkey | 26500 | 0
26502 | t1 | 26502 | 0
26505 | t1_pkey | 26505 | 0
26507 | t2 | 26507 | 0
26510 | t2_pkey | 26510 | 0
(6 rows)

I am not sure what I am doing wrong, but you can run that yourself,
and help figure out what is there in those 300+ changes.

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Stephen Frost 2021-06-17 16:30:48 Re: compression in replication
Previous Message kaido vaikla 2021-06-17 09:47:21 Re: How does vacuum full works if table is partitioned?