17.10 - Examples: Using TableSizeV - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - Data Dictionary

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Release Date
July 2021
Content Type
Administration
Programming Reference
Publication ID
B035-1092-171K
Language
English (United States)

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;