sql-server – Oracle是否具有过滤的索引概念?

前端之家收集整理的这篇文章主要介绍了sql-server – Oracle是否具有过滤的索引概念?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
sqlServer类似,我可以做以下操作
create index TimeSeriesPeriodSs1 on TimeSeriesPeriod (validationStatus,completionStatus)
where completionStatus= N'Complete'  
and  validationStatus= N'Pending'

解决方法

您可以在Oracle中创建基于函数的索引,利用NULL值不存储在b-tree索引中的事实.就像是
CREATE INDEX TimeSeriesPeriodSs1
    ON TimeSeriesPeriod( 
          (CASE WHEN completionStatus = 'Complete' AND validationStatus = 'Pending'
                THEN validationStatus
                ELSE NULL
            END),(CASE WHEN completionStatus = 'Complete' AND validationStatus = 'Pending'
                THEN completionStatus
                ELSE NULL
            END)
       );

猜你在找的MsSQL相关文章