Saturday, July 12, 2008

To see the index size of a table columns in oracle

Suppose you want to know the name of indexes and column names for a table in oracle,
Here is how you can do it.
Replace TEST_TABLE with your table name.

SELECT A.INDEX_NAME, A.TABLE_NAME, A.COLUMN_NAME, B.SIZE_MB FROM
(SELECT INDEX_NAME , TABLE_NAME, COLUMN_NAME FROM USER_IND_COLUMNS WHERE TABLE_NAME = 'TEST_TABLE') A,
(SELECT SEGMENT_NAME, SUM(BYTES)/1024/1024 SIZE_MB FROM USER_SEGMENTS GROUP BY SEGMENT_NAME) B
WHERE A.INDEX_NAME = B.SEGMENT_NAME ;

Sphere: Related Content

0 comments: