List tables by their size in Vertica database

Query below returns tables in a database with space they use ordered from the ones using most.

Query

select schema_name as table_schema,
       anchor_table_name as table_name,
       round(sum(used_bytes)/(1024^2), 2) as used_mb
from v_monitor.storage_containers sc
join v_catalog.projections p
     on sc.projection_id = p.projection_id
group by table_schema,
         table_name
order by used_mb desc;

Columns

  • table_schema - name of table schema
  • table_name - name of table
  • used_mb - space used by table in MB ( by all table projections)

Rows

  • One row represents one table in a database
  • Scope of rows: all tables in a database
  • Ordered by table size descending

Sample results