  Message Posted: Thu, 06 Jan 2005 @ 13:34:41 GMT  < Last>>

 Subj: Skew puzzle From: Sreeram Venkatasubramanian

Hello group,

I am a newbie to Teradata, so pls help me solve this one!

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
```  < Last>>

Attachments

Library

Quick Reference

Archives

Sample Index

 2016 2007 2015 2006 2014 2005 2013 2004 2012 2003 2011 2002 2010 2001 2009 2000 2008 1999

2005 Indexes

 Jan Jul Feb Aug Mar Sep Apr Oct May Nov Jun Dec

 Top Home Privacy Feedback 