简体   繁体   中英

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

It is the relpersistence column of the pg_class catalog:

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

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM