Thursday, 11 October 2012

Table Skewness and PI Distribution Check

locking rows for access
select avg(RC) as avg_rows
,max(RC) as Max_rows
,max(RC)/avg(RC) as Skew_Factor
,count(*) as distict_AMPs
,sum(RC) as RC
from
(select hashamp(hashbucket(hashrow(PI))) ,  cast(count(*) as float) as RC
 from  dbname.tablename
 group by 1
) dt;

No comments:

Post a Comment