We often come across the situation when we need to find out how much space a table in our database is actually occupying in Teradata. This may help us in identifying the tables which are using large amount of space in Database. To find out how much space a table is using in a database use below query in Teradata:
SELECT DATABASENAME as Database ,TABLENAME as Table ,SUM(CURRENTPERM)/(1024*1024*1024) (DECIMAL(15,6)) as Current_Size FROM DBC.TABLESIZE WHERE DATABASENAME = ‘YOUR_DATABASE_NAME‘ and TABLENAME='YOUR_TABLE_NAME' GROUP BY 1,2;
Where ‘YOUR_DATABASE_NAME‘ is the name of the database for which u need to do the analysis and ‘YOUR_TABLE_NAME’ is the name of the table for which you want to do the analysis.This Query will return 3 columns Database, Table and Current_Size in GB .Based on the analysis of these data we can easily see that how much space the table is occupying in the database.
However if you want to see how much all the tables in a Database is occupying , just remove the filter on Tablename from the query to get all the tables in a Database with the Permanent Size for each tables.