I need to index a Postgres column that consists of mostly NULL values. I don’t want the NULL values to be stored in the index (to make the index smaller, and to speed up row insertion). However, adding a partial index on IS NOT NULL
only lets me search efficiently for all non-null values, not for a specific non-null value.
How can I define an index on the value in this column that excludes only NULL values from the index?