![]() |
|
Archives of the TeradataForumMessage Posted: Thu, 06 Jan 2005 @ 13:34:41 GMT
Hello group, I am a newbie to Teradata, so pls help me solve this one! I had a table with a skew of about 17%. I used the query in the bottom to calculate the skew. I copied this entire table to a new table in a different database with the same primary index. I ran the same query and it shows a skew of only 0.18% !! My understanding was that the skew is based only on the data and the primary index. I have no idea how the skew got reduced when the data and the primary index are same. Any idea will be great ! Cheers, Sreeram Below is the query from the Teradata manual that I used for calculating the table skew.
SELECT di.databasename, di.tablename, di.indexname, di.indextype,
di.uniqueflag, max(columnposition) Nbr_columns,
SUM(cast(t.currentperm as decimal(18,0))/(1024*1024)) perm_mb,
100*((cast(max(t.currentperm ) as decimal(18,3)) -
cast(ave(t.currentperm ) as decimal(18,3))))
/(nullif(cast(max(t.currentperm) as decimal(18,3)),0)) as
tableskew,
100*((cast(max(t.currentperm ) as decimal(18,3)) -
cast(min(t.currentperm ) as decimal(18,3))))
/(nullif(cast(min(t.currentperm) as decimal(18,3)),0) ) as
tablevariance,
max (case when columnposition = 1 then columnname else '' end) col1,
max (case when columnposition = 2 then columnname else '' end) col2,
max (case when columnposition = 3 then columnname else '' end) col3,
max (case when columnposition = 4 then columnname else '' end) col4,
max (case when columnposition = 5 then columnname else '' end) col5,
max (case when columnposition = 6 then columnname else '' end) col6,
max (case when columnposition = 7 then columnname else '' end) col7,
max (case when columnposition = 8 then columnname else '' end) col8,
max (case when columnposition = 9 then columnname else '' end) col9
FROM dbc.indices di, dbc.tablesize t WHERE di.databasename in ('myDB')
and di.indextype = 'P'
and di.databasename = t.databasename and di.tablename = t.tablename
GROUP BY di.databasename, di.tablename, di.indextype, di.indexname,
di.uniqueflag ORDER BY di.databasename, di.tablename, di.indextype,
di.indexname
| ||||||||||||||||||||||||||||||||||||||||||||||||
| | ||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||
|
| ||||||||||||||||||||||||||||||||||||||||||||||||
| Copyright 2016 - All Rights Reserved | ||||||||||||||||||||||||||||||||||||||||||||||||
| Last Modified: 15 Jun 2023 | ||||||||||||||||||||||||||||||||||||||||||||||||