Relative Content

Tag Archive for postgresqlindexingpartial-index

Efficiently indexing sparse nullable column in Postgres

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.