1
votes

There is a composite index on ColA, colB and colC in oracle database. The query looks like this ->

where colA = ? and colB is null 
order by colC

it seems null / not null checks don't hit index so colB is of no use, but condition on colA = ? hits index. But , will Order by on colC get advantage from composite index above given that colB is of no use due to null check ?

1

1 Answers

2
votes

A composite index indexes all the columns together as one entity. It does not index each of the columns separately. So sorting order will not use the index. You need to add an index on that column.