Query the TableSpaceV View | VantageCloud Lake - Querying the TableSizeV View - Teradata Vantage

Teradata® VantageCloud Lake

Deployment
VantageCloud
Edition
Lake
Product
Teradata Vantage
Published
January 2023
Language
English (United States)
Last Update
2024-04-03
dita:mapPath
phg1621910019905.ditamap
dita:ditavalPath
pny1626732985837.ditaval
dita:id
phg1621910019905

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.

Desired Value Query
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 a SELECT statement against DBC.TableSizeV 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, go to https://support.teradata.com, log in, and search for Knowledge Article SD1000B999E.)

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