Examples: Using TableSizeV - Advanced SQL Engine - Teradata Database

Data Dictionary

Product
Advanced SQL Engine
Teradata Database
Release Number
17.00
Published
June 2020
Language
English (United States)
Last Update
2020-10-15
dita:mapPath
yoz1556235523563.ditamap
dita:ditavalPath
lze1555437562152.ditaval
dita:id
B035-1092
lifecycle
previous
Product Category
Teradata Vantage™

Example: Using TableSizeV to Contrast Total Current Disk Space with Peak Usage

The following SELECT statement is used to contrast the total disk space currently being used by the Employee table with its peak usage figure:

SELECT SUM(PeakPerm), SUM(CurrentPerm)
       FROM DBC.TableSizeV WHERE TableName='Employee';

Result:

       Sum(PeakPerm)   Sum(CurrentPerm)
       -------------   ----------------
         260,608            260,608

Example: Using TableSizeV to Display the Size of the Tables in a Map

To show the size of the tables defined in a given map:

SELECT tabv.databasename, tabv.tablename, vproc, sum(currentperm)
FROM DBC.TableSizeV tabsz, DBC.TablesV tabv 
WHERE tabsz.databasename = tabv.databasename 
AND tabsz.tablename = tabv.tablename AND mapname = 'MyMap1' 
GROUP BY 1,2,3;

Example: Using TableSizeV to Display Database Permanent Space Usage in Each AMP

To show the permanent space usage by map for each database in each AMP:

SELECT tabv.mapname, tabv.databasename, vproc, sum(currentperm)
FROM DBC.TableSizeV tabsz, DBC.TablesV tabv 
WHERE tabsz.databasename = tabv.databasename 
AND tabsz.tablename = tabv.tablename
GROUP BY 1,2,3;

Example: Using TableSizeV to Display Database Permanent Space Usage by Map in the System

To show the permanent space usage by map for each database in the system:

SELECT tabv.mapname, tabv.databasename, sum(currentperm)
FROM DBC.TableSizeV tabsz, DBC.TablesV tabv 
WHERE tabsz.databasename = tabv.databasename 
AND tabsz.tablename = tabv.tablename
GROUP BY 1,2;