Indexing on a FLAG column
We have a table which has a FLAG column amongst many columns. Now, in this column, about 95% of the column has one value and the remaining 5% another value. Because of this, when a query is explained with the 5% value, index range scan happens and the cost is less. But, when a query is explained with the 95% value, then fast full scan happens and the cost is 12-15 times more than that of that 5% value.
The problem is, this is on a production database and this particular query with 95% value, is consuming CPU and causing high CPU usage.
Any idea on what type of indexing should be used? Will Bitmap Index help? Or should we use histogram on this particular column? will that help?