PostgreSQL: toast table

TOAST is a special class of tables in PostgreSQL that store "big" data. Big data refers to rows whose size exceeds the size of one data sheet (8k), the row is split into granules ~2000 bytes in size and placed in the specified table.

PostgreSQL toast table.jpg

select relname, 
       pg_size_pretty(pg_table_size(oid)) "size"
  from pg_class 
where oid = 
    (select reltoastrelid
       from pg_class
      where relname= $$TABLENAME
        and relnamespace = 
            (select oid
               from pg_catalog.pg_namespace n 
              where nspname = $$SCHEMANAME)