RE: How to calculate size of table including size of its indexes too.

  • From: "Michael McMullen" <ganstadba@xxxxxxxxxxx>
  • To: <hansrajsao@xxxxxxxxx>
  • Date: Tue, 22 Jan 2008 13:28:03 -0500

Something like this as a "start".  I just did it for one table to test, and
you would need to use an analytical/case/decode to get only one value for
the table segment.
I said this is a "start". It will return single-row subquery errors for
partitioned tables and not return anything if a table doesn't have indexes.
So maybe not much help at all.

select z.segment_name,z.table_bytes,z.index_name,(select c.bytes/1024/1024
                                         from
                                         dba_segments c
                                         where z.index_name=
c.segment_name)index_bytes  
from
(
select a.segment_name,a.bytes/1024/1024 table_bytes,b.index_name
from
dba_segments a, dba_indexes b
where
segment_name = 'MY_SEGMENT'
and a.owner = 'MY_OWNER'
and
a.segment_name = b.table_name
) z
order by 1,3
 

--
//www.freelists.org/webpage/oracle-l


Other related posts: