Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
fabricator1
Advocate II
Advocate II

Do model relationships impact SQL queries on SQL Analytics Endpoint / Data Warehouse?

Hi!

I read this thread Solved: Re: Building relationship in Fabric Datawarehouse ... - Microsoft Fabric Community and this documentation article Define relationships in data models for data warehousing - Microsoft Fabric | Microsoft Learn which says that when I am creating relationships in the model view of SQL Analytics Endpoint or Data Warehouse, it is automatically being created PK and FK constraints in the SQL tables in order to increase query speed.

 

I am creating the relationships in the model view, because I want to use them in the Power BI semantic model.

I read in this documentation article Primary, foreign, and unique keys - Microsoft Fabric | Microsoft Learn that the PK and FK constraints are not enforced. But the article also says that the (not enforced) primary key constraint may lead to inaccurate query results if there are duplicate values in the column which has the PK (not enforced) constraint. 


So it seems that adding relationships may lead to some errors when running SQL queries on the SQL Analytics Endpoint / Data Warehouse - if the data is not in accordance with the assumptions made in the relationships. Primary, foreign, and unique keys - Microsoft Fabric | Microsoft Learn

 

It seems there are no checks in the Lakehouse or Warehouse that will prevent duplicate values in the primary key column, because the constraints are not enforced.

I'm just trying to understand 😀  Does my understanding seem right, or am I missing something? Thank you!


Ref. also:

Why is default semantic modelling experience insid... - Microsoft Fabric Community

1 ACCEPTED SOLUTION
HimanshuS-msft
Community Support
Community Support

Hello @fabricator1 
Thanks for using the Fabric community.

Your undersanding is correct as PK is not enforced the system will not stop you from entering the duplicate again . While you load you will have to make sure that duplicates are NOT inserted into the table , or may be you periodically clean up duplicate by checking on the table .


Thanks
HImanshu

View solution in original post

1 REPLY 1
HimanshuS-msft
Community Support
Community Support

Hello @fabricator1 
Thanks for using the Fabric community.

Your undersanding is correct as PK is not enforced the system will not stop you from entering the duplicate again . While you load you will have to make sure that duplicates are NOT inserted into the table , or may be you periodically clean up duplicate by checking on the table .


Thanks
HImanshu

Helpful resources

Announcements
Expanding the Synapse Forums

New forum boards available in Synapse

Ask questions in Data Engineering, Data Science, Data Warehouse and General Discussion.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayFBCUpdateCarousel

Fabric Monthly Update - May 2024

Check out the May 2024 Fabric update to learn about new features.

Top Solution Authors
Top Kudoed Authors