May 2018
Intermediate to advanced
576 pages
30h 25m
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 covered in later 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 you get all of the system tables. You can get the full list of tables to vacuum and a list of their indexes using the following query:
postgres=# SELECT relname, pg_relation_size(oid) FROM pg_classWHERE relkind in ('i','r') AND relnamespace ...