Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pg.table.size exclude TOAST, but pg.table.discovery exclude TOAST too #150

Open
triwada opened this issue Jun 28, 2019 · 0 comments
Open

Comments

@triwada
Copy link

triwada commented Jun 28, 2019

pg.table.discovery exclude TOAST tables from search, and item "pg.table.size" not include TOAST size.
In some cases the most consumed space of table will be in TOAST.
For example, table "images" from Zabbix database

select
n.nspname AS schema
,c.relname
,c.reltuples
,c.relpages
,c.relkind
,pg_relation_size(c.oid) AS relation_size
,pg_indexes_size(c.oid) AS index_size
,pg_total_relation_size(reltoastrelid) AS toast_size
,pg_total_relation_size(c.oid) AS total_relataion_size
FROM pg_class c
LEFT JOIN pg_namespace n ON n.oid = c.relnamespace
WHERE n.nspname NOT IN ('pg_catalog', 'information_schema','pg_toast') and pg_total_relation_size(reltoastrelid)>8192;
 schema | relname | reltuples | relpages | relkind | relation_size | index_size | toast_size | total_relataion_size
--------+---------+-----------+----------+---------+---------------+------------+------------+----------------------
 public | images  |       187 |       10 | r       |         81920 |      32768 |    1073152 |              1212416
(1 row)

At this case pg.table.size collect only 81920, but in fact table consume more space

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant