Commits on Aug 22, 2026
-
Add TOAST statistics columns to pg_stat_all_tables
Statistics for TOAST tables have been visible in pg_stat_all_tables as separate rows in the pg_toast schema since commit 87808ae , but there has been no way to reach them from the owning table's row. Worse, pg_stat_user_tables filters out the pg_toast schema entirely, so monitoring based on that view cannot see TOAST bloat at all. Since autovacuum processes a TOAST table independently of its main table, a table can look perfectly healthy (n_dead_tup = 0, recently autovacuumed) while its TOAST table has accumulated a large amount of dead tuples. Expose the linkage on the owning table's row, following the precedent of the toast_blks_read and toast_blks_hit columns in pg_statio_all_tables: add toast_relid, toast_n_dead_tup, toast_last_autovacuum, and toast_autovacuum_count columns, computed by joining pg_class on reltoastrelid and calling the existing statistics access functions on the TOAST relation's OID. No new counters or statistics functions are introduced. The TOAST values are deliberately not folded into the main table's own counters, since TOAST tuples are chunks of long values rather than user rows and mixing the units would make the numbers meaningless. Bump catalog version. Author: Shinya Kato <shinya11.kato@gmail.com> Reviewed-by: Discussion: https://postgr.es/m/