Re: Does TRUNCATE emit changes with REPLICA IDENTITY FULL?

Michael Paquier <[email protected]> Tue, 12 Nov 2019 09:44:32 +0900
Newsgroups gmane.comp.db.postgresql.devel.documentation
Message-ID <[email protected]>
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
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAl3KAHAACgkQnvQgOdby
QH1Kzg/+NIKxuIIM3X2oPw2Cc36jVo9REZY6WM6klLcWW0ewWEauj5LXiIUHfWgK
Da83xQ8yBOTIQN4On81K0+wOGbdiuD4VISM07/zHQ3qTRqWbBQOx4f0PL9bz7eSb
6M9FbROiM5jbbPaZI1vrdUgEcuXOX/v6Z23EziqxF0Wbz7Ab0902O2desBhog7pk
LOkHiS9eGdv6dYueW2dmxgwevY7kgBi2owDLFUDBTrVoxQzYEXojQvgK7KKjws17
uBAFbMbMGz7t6KR01IwfrLhavS6b/Lvyy8GeeYx4ux6cPM7KjYVsQ5OsJ2lEHdAL
etFtf8MYBZ/cUtqEomg/GZ6E1wWP8VcnsP+DA8fPrGqhqWSIEC88csoJVckjWC/5
SEHRPnwhGq35S0bxz2mhwUfxrm9rmyKrwC3OnGfD8lHTFVX6Wtoi9Di+4KngqthS
3i6V4RiSd8paECYrRYgdbFAMW0iSXbiGDqQmiJh0gW3jjesah++BnU4pA7B4r4Wi
ffrMTl6G1tBN/Plr69yv16ibrzWr5O9wP61mh1on9KM8a5AzdO9L0nvcPo+ekI4r
CwCPwp8j8dHQ12GOUG5/y4nYg0P6PWO0NcsDfTKEaFrpUiAer4qVvM4qHUTL08Ys
edvZ6REIIHTUYTUGQWwThGnzBA6mgYIHD55hMw3HBr1d/fo98g8=
=3NMV
-----END PGP SIGNATURE-----