• Nils Gustav Stråbø (9/1/2011)


    A similar example is how the INNER JOIN is removed (resulting in only a scan on table "child") in the following example, due to the fact that parent_id cannot be NULL and has a FK reference to table "parent".

    There's an interesting limitation here: this simplification does not work if the FK relationship uses a compound key (another good reason to use surrogate keys, some would say).

    https://connect.microsoft.com/SQLServer/feedback/details/683411/dri-referential-integrity-does-not-optimize-if-compound-key-is-used-for-the-key-relation