PROVE IT !!If you know it then PROVE IT !! Skill Proficiency Test

Query to find Skew factor of a particular table

Q 1) Query to find Skew factor of a particular table ?

Answers)

SELECT
TSIZE.DatabaseName           ,
TSIZE.TableName  ,
TDEF.CreateTimeStamp AS Created   ,
TDEF.LastAlterTimeStamp AS LastAltered          ,
TDEF.AccessCount               ,
TDEF.LastAccessTimeStamp AS LastAccess ,
SUM(TSIZE.CurrentPerm) AS CurrentPerm         ,
SUM(TSIZE.PeakPerm) AS PeakPerm,
(100 – (AVG(TSIZE.CurrentPerm)/MAX(TSIZE.CurrentPerm)*100)) AS SkewFactor
FROM DBC.TableSize TSIZE JOIN DBC.Tables TDEF
ON TSIZE.DatabaseName = TDEF.DatabaseName AND TSIZE.TableName = TDEF.TableName
WHERE TSIZE.DATABASENAME= <******* DATABASENAME *****>
AND TSIZE.TABLENAME =<****TABLENAME**********>
GROUP BY 1,2,3,4,5,6;

Add a Comment

Your email address will not be published. Required fields are marked *