Question :
In postgresql, for queries like INSERT/UPDATE/DELETE, a WAL record with required information about the tuples is created in the WAL buffer, before doing the required changes in the data buffer. Is it the same for UTILITY statements? I see an option, wal_level, to reduce the WAL entries for certain queries as in case of, create and drop table within a transaction itself. But what happens otherwise? Are the UTILITY statements logged? If so, what is the XLog record structure of those records? Thanks in advance
Answer :
wal_level
is not specific to “certain queries”. It changes the overall information written into a WAL record (e.g. to support a hot-standby).
Even non-transactional statements are logged e.g. create database
or nextval()
.
The only statements that are not logged are statements dealing unlogged tables (and – currently – hash indexes).
The Write-Ahead-Log is not for managing transactions, it’s for managing durability.