Database Administration (MOSC)

MOSC Banner

Calculate size of row !

edited Mar 25, 2012 8:55PM in Database Administration (MOSC) 2 commentsAnswered
   Hi all,
   I want calculate size of one row in table. I reference some steps to do this such as:

   1. Gather statistic of table T2 by : execute DBMS_STATS.GATHER_TABLE_STATS('TEST', 'T2');
   2. Calculate total bytes per row
select
3 + avg(nvl(vsize(T_ID),0)+1 +
               nvl(vsize(T_NAME),0)+1 +
               nvl(vsize(T_VALUE),0) + 1+
               nvl(vsize(T_DATE),0) + 1
              ) "Total bytes per row"
from 
   test.t2
where 
   t_id = 1;
  3. If table T2 has some index, must do this step:
select sum(COLUMN_LENGTH)
from dba_ind_columns
where  TABLE_NAME = 'T2';

  And final result is = result at step 2 + result at step 3.

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center