Declare and optimize with UNIQUE constraints on Databricks
Databricks introduces UNIQUE constraints in Public Preview for Unity Catalog Delta tables in Databricks SQL and Runtime 18.2+, allowing tables to record multiple uniqueness guarantees beyond a single non-nullable primary key, with nullable columns and foreign key references supported. Constraints are informational and unenforced by default; after validation, marking them RELY lets the query optimizer eliminate eligible joins and DISTINCT aggregations, with benchmarks showing 7.9x and 12.0x speedups on TPC-DS SF10000.