Does Oracle have a filtered index concept?

后端 未结 4 1879
慢半拍i
慢半拍i 2020-12-10 13:29

Similar to SQLServer where I can do the following

create index TimeSeriesPeriodSs1 on TimeSeriesPeriod (validationStatus, completionStatus)
where completionS         


        
4条回答
  •  清歌不尽
    2020-12-10 13:51

    Here's a small variant on Justin and Alex's answer that might save further index space and makes the modified query more readable IMO:

    CREATE INDEX TimeSeriesPeriodSs1
        ON TimeSeriesPeriod( 
              (CASE WHEN completionStatus = 'Complete' AND validationStatus = 'Pending'
                    THEN 1
                    ELSE NULL
               END);
    
    SELECT * FROM TimeSeriesPeriod
      WHERE 1 = (CASE WHEN completionStatus = 'Complete' AND validationStatus = 'Pending'
                    THEN 1
                    ELSE NULL
                 END)
    

提交回复
热议问题