I've got a fair amount of storage in pg_toast
relation | size
----------------------------------+---------
pg_toast.pg_toast_43934449 | 87 GB
pg_toast.pg_toast_43934438 | 64 GB
pg_toast.pg_toast_50877 | 35 GB
pg_toast.pg_toast_16715 | 15 GB
pg_toast.pg_toast_16813 | 13 GB
pg_toast.pg_toast_5706469 | 1335 MB
pg_toast.pg_toast_43934449_index | 1004 MB
pg_toast.pg_toast_43934438_index | 942 MB
pg_toast.pg_toast_16715_index | 709 MB
pg_toast.pg_toast_16813_index | 548 MB
pg_toast.pg_toast_50877_index | 530 MB
pg_toast.pg_toast_3518414 | 463 MB
pg_toast.pg_toast_16994 | 339 MB
pg_toast.pg_toast_46608 | 310 MB
pg_toast.pg_toast_16994_index | 92 MB
pg_toast.pg_toast_22345124 | 68 MB
pg_toast.pg_toast_46608_index | 51 MB
pg_toast.pg_toast_437018 | 43 MB
pg_toast.pg_toast_5706469_index | 15 MB
pg_toast.pg_toast_3518414_index | 13 MB
(20 rows)
Which is significant when the total size of the DB is currently about 420GB. This is totally expected as some of my tables are storing JSON as either text
type (for some of my older tables) or jsonb
for some of the newer ones.
A lot of these columns can be cleaned up at the application-level by just deleting some older data. The problem is that it's hard to know what's actually contributing to the pg_toast tables?
How can I reverse-trace a pg_toast to the actual row/column reference of another table?