Say I have a table with 20 million rows I want to index like so:
CREATE INDEX fruit_color
ON fruits
USING btree
(color);
Now let's say that only 2% of the fruits have a color, rest will be NULL
. My queries will NEVER want to find fruits with color NULL
(no color), so the question is, will it make a difference for postgresql if I change the index to:
CREATE INDEX fruit_color
ON fruits
USING btree
(color)
WHERE color IS NOT NULL;
I don't know much about postgresql's internal way of handling indexes, so this is why I ask.
PS postgresql version is 9.2