Last active
August 29, 2015 14:05
-
-
Save yujihamaguchi/feb4f790a10f8ca734df to your computer and use it in GitHub Desktop.
[Redshift] テーブル毎のディスクスペース確認
This file contains hidden or 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
SET SEARCH_PATH TO <schema name>; | |
SELECT | |
stv_tbl_perm.name AS table | |
,COUNT(*) AS mb | |
FROM | |
stv_blocklist, | |
stv_tbl_perm | |
WHERE | |
stv_blocklist.tbl = stv_tbl_perm.id | |
AND stv_blocklist.slice = stv_tbl_perm.slice | |
AND stv_tbl_perm.name IN ('<table name1>','<table name2>', .. '<table nameN>') | |
GROUP BY | |
stv_tbl_perm.name | |
ORDER BY | |
1 ASC; | |
-- 多分こっちでもOK | |
SELECT | |
name | |
,COUNT(*) | |
FROM | |
SVV_DISKUSAGE | |
WHERE | |
name IN ('<table name1>','<table name2>', .. '<table nameN>') | |
GROUP BY | |
name; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment