Quote:
Indexing on “active” flag will not help as it will have very low selectivity.
I'm not agree with this.
If you have for example 10 sessions with 'active' flag and 100.000 sessions with flag set to 'finished',
then a query like "from Session where flag='active'" should indeed profit extremely from the existence the index on the flag column,
because In this case you have a extremely high selectivity (1:10.000).
You have only low selectivity if you query "from Session where flag='finished'" (selectivity ~ 1:1)
but this query is not so relevant to you.
You must distinct GENERAL selectivity of boolean values (which is very low as we know),
from SPECIFIC selectivity of boolean values (=for a determinate boolean value),
which in your specific case is extremely high.
regards
Guenther D.