Declare and Optimize with UNIQUE Constraints on Databricks
Databricks, Tuesday, November 3rd, 2026
Databricks added UNIQUE constraints in Public Preview, letting tables declare multiple nullable or composite uniqueness guarantees.
Databricks announced UNIQUE constraints in Public Preview for Unity Catalog Delta tables in Databricks SQL and Databricks Runtime 18.2 and above.
Unlike a primary key, of which a table can have only one with non-nullable columns, a table can declare multiple UNIQUE constraints, and their columns can be nullable or composite.
Foreign keys can reference UNIQUE constraints as well as primary keys.
The constraints are informational and not enforced on write, but once validated and marked RELY, the query optimizer can use them to eliminate unnecessary joins and aggregations.