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