3 ms·
Half the rows to scan in 99% of cases means you’ll still hit every page and incur exactly the same amount of IO (the expensive part) as a full table scan.
by code_biologist 3y ago
Half the rows to scan in 99% of cases means you’ll still hit every page and incur exactly the same amount of IO (the expensive part) as a full table scan.
- webstrand 3y agoWould periodically clustering the table on the boolean index help here? Since then the true rows would be in different pages than the false rows. Unless I misunderstand what clustering does.
- valenterry 3y agoYes, that would indeed help.
- marcosdumay 3y agoThe thing is that, since you can only cluster around a single ordering, a boolean column is very rarely the most useful one to use. But then, given the number of things that very rarely happen in a database, you are prone to have 1 or 2 of them happening every time you do something. Just not that specific thing; but if you keep all of those rules in mind, you will always be surprised.