Hi elanir2012,
I believe your query should look like this:
SELECT
DATABASENAME
, TABLENAME
, SUM(CURRENTPERM)/1024/1024/1024 AS CURRENT_PERM
, CAST (CAST (MAX (CURRENTPERM)*(HASHAMP()+1) AS FLOAT) / CAST (1024*1024*1024 AS FLOAT) AS DECIMAL(18,2)) AS EFFECTIVE_PERM_INCLUDING_SKEW
, EFFECTIVE_PERM_INCLUDING_SKEW - CURRENT_PERM AS SPACE_WASTED_DUE_TO_SKEW
, (100 - (AVG (CURRENTPERM) / NULLIFZERO(MAX (CURRENTPERM))*100)) AS SKEW_PERCENT
FROM DBC.TABLESIZE TS
WHERE DATABASENAME = 'XYZ'
GROUP BY 1,2
ORDER BY 6 DESC
changed the expression for current_perm.
Thanks,
-Anjum.
Hi elanir2012,
I believe your query should look like this:
SELECT
DATABASENAME
, TABLENAME
, SUM(CURRENTPERM)/1024/1024/1024 AS CURRENT_PERM
, CAST (CAST (MAX (CURRENTPERM)*(HASHAMP()+1) AS FLOAT) / CAST (1024*1024*1024 AS FLOAT) AS DECIMAL(18,2)) AS EFFECTIVE_PERM_INCLUDING_SKEW
, EFFECTIVE_PERM_INCLUDING_SKEW - CURRENT_PERM AS SPACE_WASTED_DUE_TO_SKEW
, (100 - (AVG (CURRENTPERM) / NULLIFZERO(MAX (CURRENTPERM))*100)) AS SKEW_PERCENT
FROM DBC.TABLESIZE TS
WHERE DATABASENAME = 'XYZ'
GROUP BY 1,2
ORDER BY 6 DESC
changed the expression for current_perm.
Thanks,
-Anjum.