Comparing index_stats with show_space output
A reader, May 25, 2004 - 5:59 pm UTC
Hi Tom,
I used your show_space procedure to get the space used by an index. The used space numbers don't match with what's in index_stats. Why is that? Which number is right? Does it even make sense to compare the two outputs?
SQL> exec show_space('PK_DEVICE',user,'index');
Unformatted Blocks ..................... 0
FS1 Blocks (0-25) ..................... 0
FS2 Blocks (25-50) ..................... 1
FS3 Blocks (50-75) ..................... 0
FS4 Blocks (75-100)..................... 0
Full Blocks ..................... 0
Total Blocks............................ 640
Total Bytes............................. 5,242,880
Total MBytes............................ 5
Unused Blocks........................... 627
Unused Bytes............................ 5,136,384
Last Used Ext FileId.................... 12
Last Used Ext BlockId................... 21,128
Last Used Block......................... 13
SQL> analyze index pk_device validate structure;
Index analyzed.
SQL> select BTREE_SPACE,used_space from index_stats;
BTREE_SPACE USED_SPACE
----------- ----------
8000 2256
According to show_space, used space is 5,242,880 - 5,136,384 = 106416 bytes whereas according to index_stats its 2256 bytes?
Thanks.
May 25, 2004 - 6:54 pm UTC
you are using ASSM, ASSM takes it's own bite of a tablespace to manage the space (bitmap blocks).
index stats -- shows you the space used by the index data.
show space -- shows you the space used by the index segment.
Table Size
Yogesh, May 26, 2004 - 8:57 am UTC
Can we even find the size of the table in same manner ?
May 26, 2004 - 11:36 am UTC
analyze the table, you'll see info in user_tables for it. like num_rows, avg_space, avg_row_len, etc.