Improving Query Performance

Updated: January 31, 2012

Applies To: System Center 2012 - Operations Manager

The Operations Manager database responds to queries from all software development kit (SDK) client applications, many of which run simultaneously. Therefore, it is important to consider database performance when you design queries in an SDK client application. The following sections explain how to design optimized database queries.

Using Wildcard Characters

Whenever it is possible, avoid using wildcard characters in the criteria expression for a query. (For more information about wildcard characters, see Criteria Expression Syntax.) If it is necessary to use a wildcard character, limit the criteria as narrowly as possible before you use the character.

For example, when you define a criteria expression to find management servers named MSTest01, MSTest02A, and MSTest02B, the criteria expression:

ManagementServerCriteria serverCriteria = new ManagementServerCriteria("Name = 'MSTest0%'");

is more efficient than the expression:

ManagementServerCriteria serverCriteria = new ManagementServerCriteria("Name = 'MSTest%'");

Both of the preceding expressions are more efficient than the following expression:

ManagementServerCriteria serverCriteria = new ManagementServerCriteria("Name = '%Test%'");

Minimizing Query Responses

When you are obtaining information from the Operations Manager database, use a method that returns the minimum amount of necessary information. For example, if you need a specific agent-managed computer object, get an IAdministrationManagement interface from the Administration property of a ManagementGroup instance. Then, call the GetAgentManagedComputers method with criteria that return a single computer. The GetAgentManagedComputers method is more efficient than calling the GetAllAgentManagedComputers method, which returns all agent-managed computers, and then iterating through the resulting collection to find the appropriate computer.

When you query the database for monitoring objects, use partial monitoring objects whenever it is possible. Partial monitoring objects omit any custom properties that are defined for the object's class in a management pack. For more information, see Defining Queries for Monitoring Objects.

See Also