Untrusted check constraints

This metric returns the number of check constraints that have their is_not_trusted flag set to 1 in the sys.check_constraints table. This can point to a data integrity issue which should be investigated.

Install metric...

Metrics install automatically if you have SQL Monitor installed.

If you are using Redgate’s SQL Server monitoring tool, SQL Monitor, you can instantly install and run this metric on your servers.

This metric returns the number of check constraints that have their is_not_trusted flag set to 1 in the sys.check_constraints table. Untrusted constraints force SQL Server to construct less efficient query plans, because it doesn’t know enough about the kind of data contained in the table. This can point to a data integrity issue which should be investigated.

If the metric and alert tells you that untrusted constraints exist, find out which ones they are by running:

[sql]SELECT * FROM sys.check_constraints WHERE is_not_trusted = 1 AND is_not_for_replication = 0[/sql]

For details of how to fix them, see Brent Ozar’s article: Blitz Result: Foreign Keys or Check Constraints Not Trusted.

Untrusted check constraints, 3.7 out of 5 based on 3 ratings

Metric definition

Name

Untrusted check constraints

Description

The number of check constraints that have their is_not_trusted flag set to 1 in the sys.check_constraints table.

If untrusted check constraints exist, find out which ones they are by running:

SELECT * FROM sys.check_constraints WHERE is_not_trusted = 1 AND is_not_for_replication = 0

The T-SQL query that will collect data

Instances to collect from

Select all

Databases to collect from

0

Collection frequency

86400

Use collected or calculated values

Leave the Use a calculated rate of change between collections check box unchecked

Metric collection

Enabled

Alert definition

Alert name

Untrusted check constraints

Description

This alert is raised when SQL Monitor detects check constraints that have their is_not_trusted flag set to 1 in the sys.check_constraints table.

To find out where untrusted check constraints exist, run:

SELECT * FROM sys.check_constraints WHERE is_not_trusted = 1 AND is_not_for_replication = 0

Raise an alert when the metric value goes

Above the defined threshholds

Default threshold values

High:0
Medium:Disabled
Low:Disabled

Raise an alert when the threshold is passed for

1 collection

Alert is

Enabled