Similar to SQLServer where I can do the following
create index TimeSeriesPeriodSs1 on TimeSeriesPeriod (validationStatus, completionStatus)
where completionStatus= N'Complete'
and validationStatus= N'Pending'
Similar to SQLServer where I can do the following
create index TimeSeriesPeriodSs1 on TimeSeriesPeriod (validationStatus, completionStatus)
where completionStatus= N'Complete'
and validationStatus= N'Pending'
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:
You might be able to use a function-based index for this, though it isn't very pleasant for this scenario:
You'd have to make the query's
where
clause match exactly to make it use the index though.This would be a lot neater if you can define (deterministic) functions to do the
case
. See here for some further info and examples. Or this, from a quick Google.You can create a function-based index in Oracle that leverages the fact that NULL values aren't stored in b-tree indexes. Something like