How to check skew factor of table from a view

Database
Enthusiast

How to check skew factor of table from a view

I do not have access the table that a view is built on, how can i check the skew factor of the table underneath the view, is it possible? 

1 REPLY
Enthusiast

Re: How to check skew factor of table from a view

You don't need to have access to the underlying table to get the skew factor. You just need to have access to dbc.TableSizeV and run the following query (replacing the ? with the database name and table name of your table):

 

SyntaxEditor Code Snippet

Lock Dbc.TableSizeV for Access 
SELECT TableName,SUM(CurrentPerm) AS CurrentPerm,SUM(PeakPerm) AS PeakPerm,(100 - (AVG(CurrentPerm)/NULLIFZERO(MAX(CurrentPerm))*100)) AS SkewFactor 
FROM Dbc.TableSizeV 
WHERE DatabaseName=? 
AND TableName=? 
GROUP BY 1