Does TRUNCATE emit changes with REPLICA IDENTITY FULL?

Started by PG Bug reporting formover 6 years ago2 messagesdocs
Jump to latest
#1PG Bug reporting form
noreply@postgresql.org

The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/11/sql-truncate.html
Description:

Hi,

The documentation says that TRUNCATE ignores ON DELETE triggers, but it
doesn't explicitly mention what happens if we use `wal_level = logical` and
`REPLICA IDENTITY FULL`. Does TRUNCATE emit changes for each row and clog
the WAL, or will it still be blazing fast?

Kind Regards,,
m.

#2Michael Paquier
michael@paquier.xyz
In reply to: PG Bug reporting form (#1)
Re: Does TRUNCATE emit changes with REPLICA IDENTITY FULL?

On Mon, Nov 11, 2019 at 09:19:52AM +0000, PG Doc comments form wrote:

The documentation says that TRUNCATE ignores ON DELETE triggers, but it
doesn't explicitly mention what happens if we use `wal_level = logical` and
`REPLICA IDENTITY FULL`. Does TRUNCATE emit changes for each row and clog
the WAL, or will it still be blazing fast?

Truncate does not issue per-row changes with a full replica identity
in this context. It roughly just takes an exclusive lock on the
table, then physically removes all the files related to the table.
--
Michael