On the move:

I'm currently moving the following to their own blogs: Unix, HTML for Blogs, Perl & Java.
The links are on the left side.

Monday, May 26, 2008

Calculate Table Size


Compute Sum Label 'Total' Of No_Kb On Report
Compute Sum Label 'Total' Of No_Mb On Report

Select Table_Name,
-----------------------------------------------------
Num_Rows,
-----------------------------------------------------
Avg_Row_Len,
-----------------------------------------------------
Num_Rows * Avg_Row_Len
As
No_Bytes,
-----------------------------------------------------
Round(Num_Rows * Avg_Row_Len/1024,2)
As
No_Kb,
-----------------------------------------------------
Round(Num_Rows * Avg_Row_Len/1024/1024,2)
As
No_Mb
-----------------------------------------------------
From User_Tables;

Avg
Table Num Row
Name Rows Len NO_BYTES NO_KB NO_MB
------------ ----- ---- ---------- ---------- ----------
DEPT 4 20 80 .08 0
EMP 14 37 518 .51 0
BONUS 0 0 0 0 0
SALGRADE 5 10 50 .05 0
---------- ----------
Total .64 0

No comments:

Post a Comment