Tables - Display space used by a table and its indexes
--
--  Name: spaceix_tab.sql
--
--  Description: Tables - Display space used by a table and its indexes
--
--  Usage: @spaceix_tab tablename
--
select segment_name,segment_type,sum(bytes) total_bytes from user_segments
where segment_name in
   (select index_name from user_indexes where table_name = upper('&&1')) or segment_name = upper('&&1')
group by segment_name,segment_type
order by segment_type desc, total_bytes desc
;