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;