Querying the TableSizeV View - Teradata Database - Teradata Vantage NewSQL Engine

Teradata Vantage™ - Database Administration

Product
Teradata Database
Teradata Vantage NewSQL Engine
Release Number
16.20
Published
March 2019
Language
English (United States)
Last Update
2019-05-03
dita:mapPath
tgx1512080410608.ditamap
dita:ditavalPath
TD_DBS_16_20_Update1.ditaval
dita:id
ujp1472240543947
Product Category
Software
Teradata Vantage

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.