Answer the question
In order to leave comments, you need to log in
PostgreSQL integer index
Answer the question
In order to leave comments, you need to log in
I think you will not feel the difference in speed between NULL and some value. And by the way, you can easily check this, the test for this is simple.
Also asked this question.
Generate some data and check if the index uses the query with WHERE IS NULL (I think 80% NULL will be fine)
If the plan shows the use of an index, then the index stores references to ALL NULL values, and, accordingly, there is no difference.
It would be interesting to create sometimes compact indexes on "sparse" values, where references to NULL values are not stored, but usually in this case they make a one-to-one relationship with another table.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question