DBAsupport.com Forums - Powered by vBulletin
Results 1 to 8 of 8

Thread: Index Usage

  1. #1
    Join Date
    Jul 2001
    Posts
    93
    Hi,

    Is there any minumum number of rows a table should have inorder for oracle to make use of an index against that table?

    I do know selectivity of an index is a measure of the index's usefulness .

    what if a table has 50 rows with empno as unique? does oracle use the index for selects. if not why?

    Thanks in Advance

  2. #2
    Join Date
    May 2000
    Location
    ATLANTA, GA, USA
    Posts
    3,135
    If the cost of index searches I/O is greater than table search, then index will not be used.

  3. #3
    Join Date
    Jul 2001
    Posts
    93
    Hi,

    Correct me if i am wrong.

    Accessing an index is accessing the rowid right! Then if i have a unique index on a table which ha 50 rows isn't it more efficient to do an index scan and return the data rather than doing a full table scan.

    Thanks


  4. #4
    Join Date
    May 2000
    Location
    ATLANTA, GA, USA
    Posts
    3,135
    It depends upon how many rows returned by the Query.
    The emp table has 50 rows.

    For example,
    Select empid, empname
    from emp
    where empid between 1 and 30 ;
    In this case index will not be used as 60 % of the rows are returned.


    Select empid, empname
    from emp
    where empid between 1 and 3 ;
    In this case index will be used as 6 % of the rows are returned.


  5. #5
    Join Date
    Jul 2001
    Posts
    93
    Hi,

    I have a table with 25 rows. Column (A) is unique and indexed.

    So i say..

    Select * from table where a=xxxx;

    Shouldn't be a index used in this scenario. I am select just one row...

    Thanks


  6. #6
    Join Date
    Jun 2000
    Location
    Madrid, Spain
    Posts
    7,447
    index will be used coz of high selectivity although not always high selectivity means index usage, if data is not distributed uniformly the optimizer will choose FTS if there are no histograms and you are not using bind variables

    but in your case index will be used since your index is unique

  7. #7
    Join Date
    Jul 2001
    Posts
    93
    Hi,

    I performed a small test based on my previous example and the index is not being used . It is doing a full table scan.


    Thanks

  8. #8
    Join Date
    Jun 2000
    Location
    Madrid, Spain
    Posts
    7,447
    well how did you create your test table and how did you insert your unique record?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width