Database Table Size
I've always wondered how big a table is...up until recently I depended on the DBAs to retrieve such information for me.
Thanks to my good, and very helpful, friend, Mr.
Thomas Roach, I no longer have to wait
or bother the DBAs.
%_SEGMENTS contains a column called BYTES. Use this column to determine the size of your table, with just a little math.
SELECT segment_name, SUM( bytes ) / 1024 / 1024 mb
FROM user_segments
GROUP BY segment_name
ORDER BY 1
/
SEGMENT_NAME MB
------------------------------ ----------
BMP_DIVNBR_CUST 13.375
BMP_DIVNBR_JOINFACT 37.0625
BMP_DIVNBR_PROD 13.375
BMP_DIVNBR_SALES 78.6875
CUST 940
DIV .125
IDX_CUSTSKDIVNBR_SALES 2676.6875
IDX_PRODSKDIVNBR_SALES 2701.6875
JOIN_FACT 4298.125
PIM 312
PK_DIVSK .125
PK_PIMSK 8
PK_TMSK .25
PROD 2274.4375
SALES 116122.375
TIME .875
UQ_CUSTSKDIVNBR_CUST 40.125
UQ_PRODSKDIVNBR_PROD 144
There's a plethora of these scripts out in the wild...but I was originally inspired by helping Mr.
Neil Kodner out back in November (which I refer to as the "missing" month). Read his take on it
here.
Labels: dba, howto, sql