Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mKlEo-0001P0-Qi for pgsql-admin@arkaria.postgresql.org; Mon, 30 Aug 2021 17:38:27 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mKlEn-0005O7-Q2 for pgsql-admin@arkaria.postgresql.org; Mon, 30 Aug 2021 17:38:25 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mKlEn-0005Nz-EY for pgsql-admin@lists.postgresql.org; Mon, 30 Aug 2021 17:38:25 +0000 Received: from mail-qv1-xf2b.google.com ([2607:f8b0:4864:20::f2b]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1mKlEg-0008Mx-ET for pgsql-admin@lists.postgresql.org; Mon, 30 Aug 2021 17:38:24 +0000 Received: by mail-qv1-xf2b.google.com with SMTP id p17so4432901qvo.8 for ; Mon, 30 Aug 2021 10:38:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language; bh=lu4L2OTKTC1Z03oUXWMgOgiQ1wIxVvEkTu9XwL1ACbw=; b=QJPAJHRlLxdTaAIEb+e/5BIjaiaBcr1KqpGTY2h/DBqyq3EwcVsXx1dbJ/dSBseAnH UONr9J577qkEsom/GQwE8lE1LgErNhJL+b9xFFSuF1T7qrCt2asNXgYyZtNrXmgQ3ivP lmblpPg1YY9tRgvlL61y2faotFm+3d6nqyqyWqbmNVKx2SCeplv8h63FxwRpm+Hm6wLd PsA9eVLe0Z553Umu3q7zZGMt/jGtQf7HyZcVcChf7pBzR9KYUm2/GBhXdiZ9aVgSWnuB edOMsRpknwBAAh42SosTaqkYQWBRyiKuMUiLzkKZI5nzU5lMcPkxfRsXnrF3R7vwwqGH MUvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language; bh=lu4L2OTKTC1Z03oUXWMgOgiQ1wIxVvEkTu9XwL1ACbw=; b=sgfo/zM8DCgjV0W5jYMrwOX/DLt9z7q51JWPcWM6O/Z0BU7d9iSXVDaeO2dFt8Spxu C+HAY8u9HodLusvVQ7zkXWcdKQhG1EqeEmRlTGIvRkFxqzhO78EHl5rbph5nxRsarxra /qEhwWwe7tKbU8SXjsDBIONp4WE/fcpUdN1CU9QIFyckSgwzjApCGs1JzlNpx4TEHCeR DKVH6SALbHGMK8C6QwHEkzyvJFPgTvFHimaFeruG0sc0P/t1kv4e92aEMCeiiCj/w/Se qse5NO9a+517AwHvdRYCXSZCSW0S9YuRgk1Wqxg6DAL7yKMRauWL/+bYEsXwPU4ihxft PPqA== X-Gm-Message-State: AOAM5304Z3RaGbUXJgiL3Gw89GbHhCw77FF5YBXsGo4oD88ytxk7OTtL NBhBTX7kFbq0sRWgxu4zZGaULcv5sIFc6w== X-Google-Smtp-Source: ABdhPJwoEiD1NB8L7U9KSz3E22OfPa0KdjvtsV2rk9/hB1ZZea9Jq0BtlMQYsbSXPSZ6ZY3arKvMjw== X-Received: by 2002:a0c:cc0e:: with SMTP id r14mr24427908qvk.17.1630345095388; Mon, 30 Aug 2021 10:38:15 -0700 (PDT) Received: from [192.168.2.100] (pool-100-8-54-81.nwrknj.fios.verizon.net. [100.8.54.81]) by smtp.gmail.com with ESMTPSA id i67sm11689555qkd.90.2021.08.30.10.38.14 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 30 Aug 2021 10:38:14 -0700 (PDT) Subject: Re: vacuumlo To: pgsql-admin@lists.postgresql.org References: <9395a02bc37b8c7a3ca09441d288ff49e1c19c39.camel@cybertec.at> From: Mladen Gogala Message-ID: Date: Mon, 30 Aug 2021 13:38:14 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <9395a02bc37b8c7a3ca09441d288ff49e1c19c39.camel@cybertec.at> Content-Type: multipart/alternative; boundary="------------A656BDAF2879F7925B1C885F" Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multi-part message in MIME format. --------------A656BDAF2879F7925B1C885F Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit That can be verified by checking RELFILENODE of the table. VACUUM FULL changes RELFILENODE: |mgogala=# select relfilenode from pg_class where relname='emp';  relfilenode -------------        52178 (1 row) mgogala=# vacuum full emp; VACUUM mgogala=# select relfilenode from pg_class where relname='emp';  relfilenode -------------        52182 (1 row) | According to unsubstantiated rumors from https://www.postgresql.org/docs/13/catalog-pg-class.html, the definition of RELFILENODE column is as follows: relfilenode oid Name of the on-disk file of this relation; zero means this is a “mapped” relation whose disk file name is determined by low-level state ||Change of the RELFILENODE means that the relation has got a new file. And that means that vacuum full rewrites the table, just as Laurenz has said. Note that OID itself is NOT changed. || On 8/30/21 1:15 PM, Laurenz Albe wrote: > VACUUM (FULL) will write a compact copy of the table, then delete the old one, > so it temporarily needs more space. It may be a good idea to put "pg_wal" into > a different file system, so that WAL space cannot run out even if the data files > fill the file system. Then PostgreSQL won't crash, and the files will be removed. -- Mladen Gogala Database Consultant Tel: (347) 321-1217 https://dbwhisperer.wordpress.com --------------A656BDAF2879F7925B1C885F Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit

That can be verified by checking RELFILENODE of the table. VACUUM FULL changes RELFILENODE:

mgogala=# select relfilenode from pg_class where relname='emp';
 relfilenode
-------------
       52178
(1 row)

mgogala=# vacuum full emp;
VACUUM
mgogala=# select relfilenode from pg_class where relname='emp';
 relfilenode
-------------
       52182
(1 row)



According to unsubstantiated rumors from https://www.postgresql.org/docs/13/catalog-pg-class.html, the definition of RELFILENODE column is as follows:

relfilenode oid

Name of the on-disk file of this relation; zero means this is a “mapped” relation whose disk file name is determined by low-level state

Change of the RELFILENODE means that the relation has got a new file. And that means that vacuum full rewrites the table, just as Laurenz has said. Note that OID itself is NOT changed.

On 8/30/21 1:15 PM, Laurenz Albe wrote:
VACUUM (FULL) will write a compact copy of the table, then delete the old one,
so it temporarily needs more space.  It may be a good idea to put "pg_wal" into
a different file system, so that WAL space cannot run out even if the data files
fill the file system.  Then PostgreSQL won't crash, and the files will be removed.
-- 
Mladen Gogala
Database Consultant
Tel: (347) 321-1217
https://dbwhisperer.wordpress.com
--------------A656BDAF2879F7925B1C885F--