oracle 效能最佳化操作九: 屏蔽無用索引,oracle效能最佳化

來源:互聯網
上載者:User

oracle 效能最佳化操作九: 屏蔽無用索引,oracle效能最佳化

繼續“oracle 效能最佳化操作八”的例子

由於實際查詢中,還有涉及到DisposalCourseFlag=6的查詢,而此時如果用上該欄位上的索引,將是非常不明智的,效率也極低。

因此這種情況下,我們需要用特殊的方法屏蔽該索引,以便ORACLE選擇其他欄位上的索引。

比如,如果欄位為數值型的就在運算式的欄位名後,添加“+ 0”,為字元型的就並上空串:||""

如:

select * from  serviceinfo where DisposalCourseFlag+ 0 = 6 and workNo =  '36' ;

不過,不要把該用的索引屏蔽掉了,否則同樣會產生低效率的全表掃描。

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.