May 2019
Intermediate to advanced
600 pages
20h 46m
English
When we create a temporary table, we insert entries into the pg_class, pg_type, and pg_attribute catalog tables. These catalog tables and their indexes begin to grow and bloat—an issue that will be covered in further recipes. To control that growth, you can either vacuum those tables manually or let autovacuum do its work. You cannot run ALTER TABLE against system tables, so it is not possible to set specific autovacuum settings for any of these tables.
If you vacuum the system catalog tables manually, make sure that you get all of the system tables. You can get the full list of tables to vacuum and a list of their indexes by using the following query:
postgres=# SELECT relname, pg_relation_size(oid) FROM pg_classWHERE relkind ...
Read now
Unlock full access