just to better understand in which cases index is correctly used i would like to enumerate possible cases.
let's assume we have a table with "a", "b", "c", "d" columns.
we create an index on (a, b, c, d):
create index my_index on table my_table (a, b, c, d)
is it used when:
1)
where a=% and b=% and c=% and d=%
2)
where a=% and b=%
3)
where a=%
4)
where b=% and c=% and d=%
5)
where c=% order by b
6)
where a=% and b=% and c=% order by case when d is not null then d else c end
7) let's assume now we have more column for the 7 point but the index only on (a, b, c, d)
where a=% and b=% and c=% and d=% and e=% and f=% and g=%