4 ms·
As far as I know, truncate can be rolled back but it is also visible, even before the transaction is commited, to other transactions that started before: https
by LunaSea 3y ago
As far as I know, truncate can be rolled back but it is also visible, even before the transaction is commited, to other transactions that started before:
https://www.postgresql.org/docs/current/sql-truncate.html https://www.postgresql.org/docs/current/sql-truncate.html
- fovc 3y agoAh thank you! Quoting the link for others; > TRUNCATE is not MVCC-safe. After truncation, the table will appear empty to concurrent transactions, if they are using a snapshot taken before the truncation occurred. See Section 13.6 for more details. > TRUNCATE is transaction-safe with respect to the data in the tables: the truncation will be safely rolled back if the surrounding transaction does not commit.