16.10 - Querying the TableSizeV View - Teradata Database

Teradata Database Administration

Product
Teradata Database
Release Number
16.10
Published
April 2018
Content Type
Administration
Publication ID
B035-1093-161K
Language
English (United States)
Last Update
2018-04-26

The DBC.TableSizeV view provides AMP information about disk space usage at the table level. Optionally use viewnameVX for information on only those tables that the requesting user owns or has SELECT privileges on.

To find… Use the following query…
the table distribution
SELECT tablename (TITLE 'Table')
,currentperm (TITLE 'CurPerm')
,vproc (TITLE 'Amp')
FROM DBC.tablesizeV
WHERE databasename='xxx'
AND tablename = 'xxxx'
ORDER BY 2 DESC; 
disk space for a given table
SELECT SUM(currentperm)
FROM DBC.tablesizeV
WHERE databasename='xxx'
AND tablename = 'xxxx';

If you submit a SELECT statement against DBC.TableSizeV and notice it takes a long time to process, replace the view definition by submitting the following query:

REPLACE VIEW DBC.TableSizeV
AS SELECT  DataBaseSpace.Vproc,
   Dbase.DatabaseName (NAMED DatabaseName),
   Dbase.AccountName,
   TVM.TVMName (NAMED TableName),
   DataBaseSpace.CurrentPermSpace(NAMED CurrentPerm,
FORMAT '---,---,---,---,--9'),
   DataBaseSpace.PeakPermSpace(NAMED PeakPerm,
FORMAT '---,---,---,---,--9')
FROM  DBC.Dbase, DBC.DataBaseSpace, DBC.TVM
WHERE DataBaseSpace.TableID <> '000000000000'XB
AND  DataBaseSpace.TableID = TVM.tvmid
 AND  TVM.DatabaseId = Dbase.DatabaseId
   WITH CHECK OPTION;

This improved definition helps the Optimizer choose a better plan to process SELECT requests. (For more information, see Knowledge Article SD1000B999E.)

You may also want to look at the individual tables within the database to see if any are skewed.