On 5/22/20 7:48 AM, Nico De Ranter wrote: > The original server was running 9.5.14 > The system I am currently testing on is 11.8 > > 2 fields are marked as 'extended'. However if I understand correctly > the table isn't actually toasted: > > > oid | table_schema | table_name | total_bytes | > total | index | toast | table > -------+--------------------+-------------------------+--------------+------------+------------+------------+------------ > 19601 | public | file | 147648061440 | > 138 GB | 57 GB | 8192 bytes | 80 GB
What query are you using to get above?
SELECT oid, table_schema, table_name, total_bytes, pg_size_pretty(total_bytes)AS total , pg_size_pretty(index_bytes)ASINDEX, pg_size_pretty(toast_bytes)AS toast , pg_size_pretty(table_bytes)ASTABLEFROM(SELECT*, total_bytes-index_bytes-COALESCE(toast_bytes,0)AS table_bytes FROM(SELECT c.oid,nspname AS table_schema, relname AS TABLE_NAME , c.reltuples AS row_estimate , pg_total_relation_size(c.oid)AS total_bytes , pg_indexes_size(c.oid)AS index_bytes , pg_total_relation_size(reltoastrelid)AS toast_bytes FROM pg_class c LEFTJOIN pg_namespace n ON n.oid = c.relnamespace WHERE relkind ='r') a
) a orderby total_bytes desc;