Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get the table size in Teradata?

Tags:

teradata

I have a table in Teradata. I would like to know its size. The same thing might be interesting for databases in Teradata.

How can I do it?

like image 679
Stefan Papp Avatar asked Apr 22 '15 07:04

Stefan Papp


People also ask

How does Teradata calculate row size?

Procedure. Perform the following procedure to complete the Row Size Calculation form for each table. Identify each column in the table and enter its name in the Column Name column. Identify the data type for each column and enter it in the Type column next to the column name.

What is skew factor in Teradata?

Skewness is the statistical term, which refers to the row distribution on AMPs. If the data is highly skewed, it means some AMPs are having more rows and some very less i.e. data is not properly/evenly distributed. This affects the performance/Teradata's parallelism.


1 Answers

To check your table size you can check from dbc.tablesize. check the below query.

SELECT 
     A.DatabaseName
    ,A.tablename
    ,CreateTimeStamp
    ,CAST(SUM(CURRENTPERM) AS DECIMAL(18,2))/(1024*1024*1024) (TITLE 'Used(GB)')
FROM dbc.tablesize A,DBC.TABLES B
WHERE   A.TABLENAME=B.TABLENAME
    AND A.DatabaseName = B.DatabaseName 
    AND A.DatabaseName = 'your database name/schemaname/appname'
    AND A.tablename = 'your tablename'
GROUP BY 1,2,3 ORDER BY 3 DESC;  

To check data base size you can use dbc.diskspace, the query will be something like this:

SELECT 
     DatabaseName
    ,CAST(SUM(CurrentPerm) AS DECIMAL(18,5))/(1024*1024*1024) (TITLE 'Used(GB)')
    ,CAST(SUM(MaxPerm) AS DECIMAL(18,5))/(1024*1024*1024) (TITLE 'Allocated(GB)') 
    ,CAST(SUM(MaxPerm)-SUM(CurrentPerm) AS DECIMAL(18,5))/(1024*1024*1024) (TITLE 'Free(GB)')
FROM DBC.DiskSpace
WHERE DatabaseName = 'databasename'
GROUP BY 1
ORDER BY 2 Desc; 

This will give you used space, allocated space and free space available in your database.

like image 165
Aritra Bhattacharya Avatar answered Jan 03 '23 17:01

Aritra Bhattacharya