Hi guys.
Is there any command to know the size of a database on disk (columnstore) and RAM (rowstore)? I saw that memsql studio provides this information, but would there be a terminal command for it?
This information is available in the information_schema
database in the mv_columnstore_files
, table_statistics
, and columnar_segments
tables. For example, this query will give you how much columnstore and rowstore data you have for each of your databases:
SELECT rowsegs.database_name,
rowstore_in_gb,
columnstore_in_gb
FROM (SELECT database_name,
Round(Sum(memory_use / 1024 / 1024 / 1024), 3) AS rowstore_in_gb
FROM information_schema.table_statistics
GROUP BY database_name) rowsegs
LEFT JOIN (SELECT database_name,
Round(Sum(compressed_size) / 1024 / 1024 / 1024, 3) AS
columnstore_in_gb
FROM information_schema.columnar_segments
GROUP BY database_name) colsegs
ON rowsegs.database_name = colsegs.database_name;
2 Likes