Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

If the zeroes are most of the common value, it could be slower to use the index when searching for zeroes. How so? Reading values that aren't included in the index require following a reference back to the table row. If 90% of the rows in your query are zeroes, you'd be better of not using that column in your query planning. A naive filter, possibly even after a table scan, is likely to be faster than using the index.


Would an index of the non-0 rows still help?


Yes. If your WHERE clause is searching for only the ones for instance.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: