Improving performance by Declarative Referential Integrity (DRI)

Declarative Referential Integrity (DRI) ensures integrity of the database by a properly managed primary key and foreign key relationship. Correctly defined primary keys and foreign keys help query optimizer to select the best-suited execution plan for the query.

It has been observed many times that developers create a master table with a primary key and use that primary key field in the child table but don't define a foreign key in the table schema. This is not a good practice because by initiating a foreign key in the child table, you ensure that each record in the child table has a reference key in the parent table. This is a good thing, right? But, let us clarify that, by maintaining ...

Get Microsoft SQL Server 2012 Performance Tuning Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.