While columns defined with PRIMARY KEY or UNIQUE constraints not only cannot be null, but must also be explicitly defined as NOT NULL, nullable columns are valid for UPI and NUPI column definitions. This is not good database design practice. Permit nullable columns in index definitions only under extraordinary conditions.
These semantics demand that nulls in unique index columns must be treated as if they are equal even though SQL nulls only represent an absence of value, which means they can neither be equated nor compared in any other way. All null primary index rows hash to the same AMP, so even a UPI can produce row distribution skew if you allow it to be null. See Inconsistencies in How SQL Treats Nulls for a description of other inconsistencies.
UNIQUE or UNIQUE PRIMARY Index Format | Result |
---|---|
Single column | That column can have only one row with a null value. |
Multiple columns | The table can have at most one row in which all values are identical. |