How to calculate index size
Sujit, February 15, 2005 - 10:21 pm UTC
Hi tom,
I have been through </code>
http://asktom.oracle.com/pls/asktom/f?p=100:11:::::P11_QUESTION_ID:1295520444744 <code>I understand that the size cannot be correctlt predicted. But we can't say the same to our clients. So i wanted to know if at all we can have a idea on what space index can take.
I have a non-partitioned table with a non-paertitioned (b-tree) index on a varchar2 column (column size is 20).
I have some 50/100 rows inserted in the table (in my test database). I want to calculate avg. index size (per row). I have tried,
select sum(bytes) size_bytes from user_extents where
segment_type = 'INDEX'
and segment_name = <INDX_NAME>;
also tried,
analyze index A_NUM_IDX validate structure;
analysed.
select lf_rows, del_lf_rows from index_stats;
Row# LF_ROWS DEL_LF_ROWS
1 51 0
How can i calculate the index size (in bytes) from the above information? Is there any other way?
I just need an estimation.
February 16, 2005 - 7:48 am UTC
<quote>
But we can't say the same to our clients.
</quote>
what you have to lie to them? I say it all of the time. I can give you the gross overestimation (probable worst case), I can give you the probable best case. Somewhere in between will be reality.
There are two cases here:
If you wrote the application (eg: you have the schema already) you should be able to tell them PRECISELY based on your own empirical knowledge.
If you are getting ready to write the application -- dbms_random.random() would help -- for I don't think you can even say at this time "we will have 50 indexes on these columns".
You need to load somewhere between 0.1 and 10% of the data. Unless your table has 1,000 rows in it in real life, 50/100 "is not enough", not nearly. And if it does have 1,000 rows in it, the index will be "tiny" and that is more than enough to know unless I'm missing something.
If you want to size based on their data, use create table as select with the sample clause and get a healthy sample of their data, index it and then you can measure.
The index estimation tools in enterprise manager/grid control apply a formula and give you a number in between "worst" and "best" cases.
Table size calculation
Dheeraj, June 15, 2007 - 6:28 am UTC
Tom,
Can you provide how to calculate the row length?
How to decide the value of the intial storage parameters?
Thanks,
Dheeraj
A reader, June 20, 2007 - 9:50 am UTC
That's helpful Tom,
Though I am looing at a small document which talks about the Table Sizing...
Could you provide me with the same...that should be great.
Thanks a ton,
Dheeraj
June 20, 2007 - 11:16 am UTC
I don't need to, apparently you already have one.