Sargable vs Non-sargable queries

Sargable vs non-sargable query What are sargable and non sargable queries? A query is considered to be sargable if it’s able to take advantage of an index to speed up the execution of a query. A non sargable query is the opposite of that where the dbms engine is unable to take advantage of an index. Person table Let’s say there’s a Person table and an index with the following SQL:...

September 3, 2024 · 3 min · Samuel Tambunan

SQL Constraints and Triggers

Overview Data integrity in SQL server can be enforced by the use of constraints and triggers. This post will quickly compare both constraints and triggers and explain the main differences between them. Constraints Check constraints are used to validate that the data going into the table follows certain rules. Constraints are really simple to use but also have the downside of not being as complex as triggers. They can be placed in the column to ensure that data in the column follow certain rules....

August 25, 2024 · 4 min · Samuel Tambunan