what type of index to be created on a column in a table in oracle where only Yes or No values are updated

When a column in an Oracle table stores only two distinct values like 'Yes' or 'No', creating a standard B-tree index on it is not efficient, because:

  • The column has low cardinality (few distinct values),
  • B-tree indexes are most effective on high-cardinality columns.

✅ Best Practice: Bitmap Index

You should create a bitmap index on that column.


📌 Why Bitmap Index?

  • Ideal for columns with low cardinality (few unique values),
  • Efficient for queries like:
  • SELECT * FROM table_name WHERE status = 'Yes';
  • Performs well in combination with other bitmap indexes (for multi-column filtering),
  • Uses less space than B-tree for such data.

⚠️ Considerations:

  • Bitmap indexes are not recommended on columns that are frequently updated in OLTP systems, because:
  • They can cause locking issues,
  • Best suited for data warehouses or read-heavy workloads.

✅ Syntax:

CREATE BITMAP INDEX idx_status_bm ON your_table(status_column);

If you're on a transactional (OLTP) system and the column is updated very frequently, then:

  • Consider not indexing it, or
  • Use a function-based index only if queries filter with additional conditions and performance is critical.


Post a Comment

And that's all there is to it!

If anyone has any other questions or requests for future How To posts, you can either ask them in the comments or email me. Please don't feel shy at all!

I'm certainly not an expert, but I'll try my hardest to explain what I do know and research what I don't know.

Previous Post Next Post