All true. The way the VACUUM truncation works confuses people sometimes. The database has to exclusive lock the very last page of the table to shrink the file. It does that over and over again, until it finds a page that's still live.
All true. The way the VACUUM truncation works confuses people sometimes. The database has to exclusive lock the very last page of the table to shrink the file. It does that over and over again, until it finds a page that's still live.
@postgresperf Yes, an access-exclusive lock is needed for truncation. Since some users may prefer to avoid this, I implemented the "vacuum_truncate" storage parameter, allowing them to choose whether truncation should occur.