Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: INDEX - row selectivity Vs block selectivity.
If I recall correctly, Cary's was primarily an explanation of why it is not
even theoretically plausible to have a general thumbrule of the form
Use an index if it selects less than x% of the rows
(Since Oracle reads blocks, not rows, predictions of how many blocks you will read based on row selectivity are impossible except for special conditions:
Now, what do you do about it?
Now, and maybe more to the point of your actual question:
The way to use this method to evaluate whether to use an index or not is to run the query with and without the index and see which one is either faster or less consumptive of a resource you expect to consume at near capacity in full production (the only reason not to go with the fastest one that occurs to me.) The relevant statistics other than elapsed time might include cpu, lio, and pio, but if your production system will have lots of head room on any of those you shouldn't worry about it (unless you're trying to figure a way to squeeze into a smaller box, or your guesses about future capacity and growth are uncertain.) Remember that selectivity may vary by the predicate values, especially when the table was populated from occasional batches where some of the batches were ordered with respect to the index in questions and other batches were in some other or no particular order. The relative selectivity of an index with respect to rows and blocks can vary wildly as the contents of the table change and for predicate values. A well informed CBO should make the correct choices for you, as long as you don't do something to prevent it from using the index when it is good to use the index. If you believe the wrong choice is being made, then you trace an execution with and without the index for truth, and do a Wolfgang on the query to find out why the CBO is making the choice it is making.
Regards,
mwf
-----Original Message-----
From: oracle-l-bounce_at_freelists.org
[mailto:oracle-l-bounce_at_freelists.org]On Behalf Of Jaffar_DBA
Sent: Monday, December 13, 2004 10:19 AM
To: oracle-l_at_freelists.org
Subject: INDEX - row selectivity Vs block selectivity.
Hello list,
I was reading an excellent paper written by Mr. Carry Millsap about when to use indexes and I was very much interested to know more about block selectivity. Could any one tell me more about how can we estimate block selectivity for the index. It was there in the paper, but, still I am confused. How can I used this method to evaluate to use an index or not. At the beginning, table may contain little data (few data blocks), later on, it could grow heavily. Then, do we have to recalculate the formula again to make sure to use an index or not?
Thanking you in advance.
--
Best Regards,
Jaffar, OCP DBA
Banque Saudi Fransi
Saudi Arabia
--
http://www.freelists.org/webpage/oracle-l
--
http://www.freelists.org/webpage/oracle-l
Received on Mon Dec 13 2004 - 11:17:01 CST
![]() |
![]() |