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


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.

  • If CREATE/DROP/ALTER statements are logged, what is the record structure of those? what re the information regarding a create table is kept in log? – krithikaGopalakrisnan Oct 6 '16 at 8:41
  • @user4658312: I have no idea. You need to check the source code – a_horse_with_no_name Oct 6 '16 at 8:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.