Quantcast
Channel: Madeira Data Solutions
Viewing all articles
Browse latest Browse all 145

How to Get the Size of Tables in Vertica

$
0
0

If you need to query the size of tables in Vertica, then you have several ways to do it. I will demonstrate two options. The first is based on projection storage, while the second is based on columns storage. Both of them aggregate the data based on table schema and table name.

Here is the first query, based on v_monitor.projection_storage:

SELECT
anchor_table_schema ,
anchor_table_name ,
SUM (used_bytes) / (1024^3) AS used_gb
FROM
v_monitor.projection_storage
GROUP  BY
anchor_table_schema ,
anchor_table_name
ORDER  BY
SUM (used_bytes) DESC;

 

And here is the second query, based on v_monitor.column_storage:

SELECT
anchor_table_schema ,
anchor_table_name ,
SUM (used_bytes) / (1024^3) AS used_gb
FROM
v_monitor.column_storage
GROUP  BY
anchor_table_schema ,
anchor_table_name
ORDER  BY
SUM (used_bytes) DESC;

 

A few comments:

  1. Both queries return the size of tables in GB.
  2. Both queries return the compressed size of the tables.
  3. The second query will also return empty tables, while the first query will not.

The post How to Get the Size of Tables in Vertica appeared first on madeiradata.


Viewing all articles
Browse latest Browse all 145

Trending Articles