hi Rajeev,
i dont know about the DB level but for table level use this:
SELECT databasename
, tablename
, MAX(CurrentPerm) * (HASHAMP()+1)/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 = 'name of DB'
GROUP by 1,2
ORDER BY 5 DESC
hi Rajeev,
i dont know about the DB level but for table level use this:
SELECT databasename
, tablename
, MAX(CurrentPerm) * (HASHAMP()+1)/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 = 'name of DB'
GROUP by 1,2
ORDER BY 5 DESC