Created
March 11, 2019 11:14
-
-
Save Barathchander/25c1fed852a415f26c3ee40ad4681cc5 to your computer and use it in GitHub Desktop.
query to return redshift DB size
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select sum(mbytes)/1024, database from ( | |
select trim(pgdb.datname) as Database, | |
trim(a.name) as Table, b.mbytes | |
from stv_tbl_perm a | |
join pg_database as pgdb on pgdb.oid = a.db_id | |
join (select tbl, count(*) as mbytes | |
from stv_blocklist group by tbl) b on a.id=b.tbl | |
where a.slice=0 | |
order by db_id, name) | |
group by database; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment