Skip to content

Instantly share code, notes, and snippets.

@yujihamaguchi
Last active August 29, 2015 14:05
Show Gist options
  • Save yujihamaguchi/feb4f790a10f8ca734df to your computer and use it in GitHub Desktop.
Save yujihamaguchi/feb4f790a10f8ca734df to your computer and use it in GitHub Desktop.
[Redshift] テーブル毎のディスクスペース確認
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