Foreign Key Constraints – JOIN Elimination

JOIN Elimination in Microsoft SQL Server is an optimization technique with foreign key constraints where the query engine removes redundant JOIN operations during query execution. This occurs when the data from the joined table is not used in the SELECT clause or any...
Foreign Key Constraints – Part II

Foreign Key Constraints – Part II

My first article on using foreign key constraints in databases included the claim that using them slows down an application. This article addresses the claim that a Foreign Key Constraint use locks and can cause Deadlocks and thus slow down applications. Claim Foreign...

Consider the correct data type in queries

Although an index should provide a fast query, Microsoft SQL Server either does not want to use that index at all or does not want to use it optimally. The cause is not SQL Server or the index but think about the correct data types for your predicates in your queries!...

ISNULL() and SARGable queries

Database developers like to use the ISNULL() function to check two conditions and compare them with a search value. This is often done with the intention of finding records that do not have a value stored in the attribute. Sometimes they can get lucky – but not...