alfonx
alfonx

Reputation: 7216

List all UNLOGGED tables in Postgresql database

Since version 9.1, PostgreSQL supports the creation of UNLOGGED tables which do not use the WAL and are truncated during any DB recovery. See documentation: create unlogged table

Where does PostgreSQL store the information, whether a relation is UNLOGGED? I am looking for a query to list all relations that are UNLOGGED.

Thanks in advance

Upvotes: 9

Views: 6668

Answers (2)

Vivek Tripathy
Vivek Tripathy

Reputation: 201

https://www.postgresql.org/docs/current/catalog-pg-class.html

select relname, relowner from pg_class where relpersistence='u';

Upvotes: 8

Clodoaldo Neto
Clodoaldo Neto

Reputation: 125434

It is the relpersistence column of the pg_class catalog:

http://www.postgresql.org/docs/9.1/static/catalog-pg-class.html

Upvotes: 15

Related Questions