Find skew with perm over 1gb

Database
vc
Enthusiast

Find skew with perm over 1gb

Hello,

I am using the below query 

SELECT 

cast(DatabaseName as char(30)),

cast(Tablename as char(40)),

(100 - (AVG(CURRENTPERM)/MAX(CURRENTPERM)*100) (FORMAT 'zz9.99') )AS Skewfactor_greater_90,

cast (CURRENT_date as timestamp(0)) + ((current_time -time '00:00:00') hour to second(0)) As AS_ON

FROM 

DBC.TABLESIZEV 

where  DATABASENAME like ('prstn%')

having Skewfactor_greater_90 >=90

GROUP BY 1,2

Order by 1,3;

As the query is finding and calculating skew in term od percentage  and displaying the ones greater than 90

How can  we find  the skew with perm over 1 GB????

1 REPLY
Teradata Employee

Re: Find skew with perm over 1gb

SELECT 
cast(DatabaseName as char(30)),
cast(Tablename as char(40)),
(100 - (AVG(CURRENTPERM)/MAX(CURRENTPERM)*100) (FORMAT 'zz9.99') )AS Skewfactor_greater_90,
cast (CURRENT_date as timestamp(0)) + ((current_time -time '00:00:00') hour to second(0)) As AS_ON
FROM DBC.TABLESIZEV
where DATABASENAME like ('prstn%')
having Skewfactor_greater_90 >=90
and sum(CURRENTPERM)>1024*1024*1024
GROUP BY 1,2
Order by 1,3;