Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
silvestrov
on Dec 7, 2023
|
parent
|
context
|
favorite
| on:
Everyday performance rules for Ruby on Rails devel...
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
on Dec 7, 2023
[–]
Correct, 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
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search:
CREATE INDEX index_accounts_balance ON accounts (id) WHERE boolean_flag;