Table sizing in bytes

Database
N/A

Table sizing in bytes

Hello Experts,

Could someone tell me how I could calculate the table size of a teradata table in bytes?

Appreciate your help!

Regards,

jerk

3 REPLIES
Enthusiast

Re: Table sizing in bytes

Formula

(BlockSize -38_/RowSize = RowsPerBlocl
RowCount /RowsPerBlock = Bolcks
NumAmps *1024 = Header
(Blocks * BlockSize )+ Header = Nofallback
(Blocks * BlockSize )*2 + Header = fallback

Parameters

38 =Block Header + Block Trailer
1024 = Typical table header size

BlockSize = Typical block size in bytes
NumAmps = Number of amps in the system
RowCount = Number of table rows expected
RowSize = Physial row size
Enthusiast

Re: Table sizing in bytes

For an existing, populated table, you can query DBC.TableSize.

Example:

Select sum(currentperm) from dbc.tablesize
where databasename = 'mydbname'
and tablename = 'mytablename';
Enthusiast

Re: Table sizing in bytes

Something that might give you a bit more information.

-- Tables and their size

Select
tbl.DatabaseName
,tbl.TableName
,tbl.CreatorName as Creator
,sum(tsize.currentperm) asPermSize
,max(tsize.currentperm)/avg(tsize.currentperm) (decimal (18,2)) (named SkewRatio)
,max(tsize.currentperm) (named BytesUsedTopAmp)
from dbc.tables tbl
inner join
dbc.tablesize tsize
ON
tbl.Tablename = tsize.Tablename
and
tbl.Databasename = tsize.Databasename
and
tbl.Tablekind = 'T'
where
--tbl.databasename in ('mydatabase') --All tables in these databases
--and cast(tbl.createtimestamp as date) >= date -- Tables created after a specific date
--tbl.tablename in ('mytable') -- A specific table
tbl.creatorname = user --Your tables
group by 1,2,3
order by 4 desc;