Quantcast
Channel: Forum SQL Server Database Engine
Viewing all articles
Browse latest Browse all 15889

Join Elimination not working with FK to view

$
0
0

In our dimensional data warehouse we have a fact table with foreign keys to dimension tables.  In some cases, a view is used for a dimension table to reuse the underlying generic table.  The fact table key field has a foreign key referencing the underlying dimension. However, the join elimination is not working with these views.

Suppose I have a view for DimShippingDate that is based on DimDate, with the key DateKey just renamed to ShippingDateKey.  In my fact table I have a foreign key on ShippingDateKey that references DateKey in DimDate.  If I do not use ShippingDate in my query, the join to DimDate is still not eliminated.  This seems to be the case for all my virtual dimensions.  Is there something else I need to do for the optimizer to know the join can be eliminated?


Viewing all articles
Browse latest Browse all 15889

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>