Subject RE: [firebird-support] index selectivity
Author Leyne, Sean
> Hello, I've been reading this FAQ and I undestand that having an index on a
> boolean field is the worst of the cases. But I've also seen that if you have (as
> in my case) very little "active" records (MyBoolean = 1) and a LOT of inactive
> records, is good to have an index to select the active records.
> Is that True? Should I create an index on my boolean field?

Yes, unless you can combine the Boolean field with another filed which is used very commonly is your SELECTs.

Otherwise, you should not index a low selectivity field (boolean) the cost* of the index is not worth it.


*Cost includes several factors,, including the extra I/O operations required to maintain the index as well as the fact that the engine might want to include the field/index into a SELECT which would result in a slower performing statement.