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

Thread: Explain for Function Based Index

  1. #1
    Join Date
    Aug 2000
    Location
    Shanghai
    Posts
    433

    Explain for Function Based Index

    CBO
    create index test on bb(substr(dm,1,7));
    create index test1 on bb(upper(dm));
    -------------------------------------
    1.select * from bb where substr(dm,1,7)=' 1350300' ;
    2.select * from bb where upper(dm)='13503000000';

    while executing 1st sql , the index test is not used but for the 2nd sql , the index test1 is choosed to be used.

    Any special reason?
    1. www.dbasupport.com
    2. www.dbforums.com
    3. www.itpub.net
    4. www.csdn.net
    5. www.umlchina.com
    6. www.tek-tips.com
    7. www.cnforyou.com
    8. fm365.federal.com.cn
    9. www.programmersheaven.com
    10.http://msdn.microsoft.com/library/default.asp
    ligang1000@hotmail.com

  2. #2
    Join Date
    Dec 2002
    Location
    Bangalore ( India )
    Posts
    2,434

    Re: Explain for Function Based Index

    Originally posted by ligang
    CBO
    create index test on bb(substr(dm,1,7));
    create index test1 on bb(upper(dm));
    -------------------------------------
    1.select * from bb where substr(dm,1,7)=' 1350300' ;
    2.select * from bb where upper(dm)='13503000000';

    while executing 1st sql , the index test is not used but for the 2nd sql , the index test1 is choosed to be used.

    Any special reason?
    cud be due N number of reasons...
    But any ways Remove the space in ur 1st qry or make it 7 char'd constant val and see...
    funky...

    "I Dont Want To Follow A Path, I would Rather Go Where There Is No Path And Leave A Trail."

    "Ego is the worst thing many have, try to overcome it & you will be the best, if not good, person on this earth"

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