2 ms·
If the boolean values are not 50%/50% but skewed like 1%/99% then there can be a big advantage in using a partial index CREATE INDEX index_accounts_balance ON
by silvestrov 3y ago
If the boolean values are not 50%/50% but skewed like 1%/99% then there can be a big advantage in using a partial index
CREATE INDEX index_accounts_balance ON accounts (id) WHERE boolean_flag;
- andatki 3y agoCorrect, when the query conditions match the index conditions, and they both select a low proportion of the rows. For PostgreSQL and those unfamiliar with partial indexes, worth a read: https://www.postgresql.org/docs/current/indexes-partial.html https://www.postgresql.org/docs/current/indexes-partial.html