Quantcast
Channel: Teradata Forums - Database
Viewing all articles
Browse latest Browse all 14773

How to find table size and index size using Ferret utility - response (1) by dnoeth

$
0
0

Hi Sharib,
COLLECT DEMOGRAPHICS is usually quite close to the actual size (but i doesn't include Fallback size), i use a query like this to get a percentage for each SI:

SELECT
   dd.DatabaseName
   ,dd.TableName
   ,i.IndexNumber
   ,dd.IndexName
   ,dd.SubTableId 
   ,dd.SubTableType 
   ,dd.SubTableSize
   ,dd.CurrentPerm
   ,100*SubTableSize/CurrentPerm
FROM 
 (
   SELECT
      DatabaseName
      ,TableName
      ,SubTableId 
      ,SubTableType
      ,MIN(IndexName) AS IndexName
      ,SUM(RowCount * (AvgRowSize+0.5)) AS SubTableSize
      ,SUM(SubTableSize) OVER (PARTITION BY DatabaseName, TableName) AS CurrentPerm
   FROM DataDemographics
   GROUP BY 1,2,3,4
 ) AS dd
LEFT JOIN DBC.Dbase AS db
ON dd.DatabaseName = db.DatabaseName
LEFT JOIN DBC.TVM AS t
     ON db.DatabaseId = t.DatabaseId
     AND dd.TableName = t.TVMName
   LEFT JOIN dbc.Indexes AS i
     ON t.TVMId = i.TableId 
     AND i.FieldPosition = 1
     AND CASE
             WHEN dd.SubTableID = 1024 THEN 1
             ELSE dd.SubTableID-1024 
         END = i.IndexNumber
ORDER BY 1,2,3
;

 
Using Ferret you have to look at the output of "SHOWB /l" to get the exact number of datablocks of each size for each subtable or "SHOWB /m" for an average size and then do some math.
 
Dieter


Viewing all articles
Browse latest Browse all 14773

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>