So i define bitmap index for column_a
. then i query
Select column_a, column_b
from table_name
where column_a = 'values';
But after i check the Explain plan, my query still do a table access full scan. but if i only do
Select column_a
from table_name
where column_a = 'values';
it successfully use my defined index
1 | BITMAP CONVERSION TO ROWIDS
2 | BITMAP INDEX SINGLE VALUE
my question then, should i define all index on all columns that i want to query? even though some of the columns have high cardinality?
Index should cover where clause columns along with table columns mentioned in select clause. In general you should at least cover where clause columns and depending on column data type,frequency of usage of query select clause may follow. Remember over indexed table can degrade database performance
Oracle official documentation