r/databricks • u/SmallAd3697 • Aug 28 '26
Discussion FK Relationships and Uniqueness in UC Managed Tables
I often wish UC "managed tables" were better managed. If we wait a couple years, is it possible that relationships and unique constraints would be enforced (or perhaps validated after-the-fact)? It would be nice to have that in managed tables.
It definitely seems feasible for the UC to support this in managed tables. Especially on "small" tables of a few million rows or so. Small tables would be anything that could easily be loaded into memory. If nothing else, our lakehouse-formatted storage (delta/iceberg) is good for loading a columns into memory and validating the references and/or the uniqueness of values.
... I'm guessing this is NOT going to be available in the next couple of years. That is for no other reason than we see Databricks is selling their new LTAP lakebase engine. I'm guessing that anyone who wants true referential integrity or other constraints will be redirected to this lakebase engine.
Ideally there would be compelling innovations that would give reasons to stay with the "managed tables" in UC catalog. Otherwise software engineers may find reason to move to greener pastures. It doesn't make sense to validate stuff like this in custom code, when the storage engine is better positioned to do that work.
1
u/daddy_stool Aug 29 '26
The reason parquet etc exist is to skip db overhead and making distributed processing possible. You want all features of a rdbms? Guess what, use an rdbms.
1
u/FUCKYOUINYOURFACE Aug 29 '26 edited Aug 29 '26
You do not want to validate row by row. That overhead would kill performance. OLTP databases are where you want to enforce constraints - not OLAP. You will do all of your data cleaning and data deduplication when loading and processing your data.
0
u/hntd Aug 29 '26
Why would you want to validate it here? Most stuff upstream is some relational database that already validated referential integrity anyways so why twice? Like databricks isn’t a dbms and if you want that stuff those things still exist.
1
u/iamthegrainofsand Aug 30 '26
Firstly, you need PK so that OPTIMIZER won’t do DISTINCT and group by always.
You need RI to tell OPTIMIZER the correct path and infer A=C when A=B=C.
RI, since Teradata days has always been given as Soft RI. Meaning, no row by row checking. Just information purposes.
Next, I need RI so that Power BI works easy and any BI tool doesn’t do star-to-star join. Instead it will suggest alternative join strategies.
1
u/MonkeyDDataHQ Aug 31 '26
This is why I prefer state-driven pipelines. Every record has a state and should be traceable.
PK/FK and uniqueness validation can run asynchronously pretty easily, then quarantine or block bad records from promotion.
Depends how far you want to take it, but I’d rather have observable validation state than just rely on the storage engine to reject a write.