Today we are going to see about the relation between Collection Evaluation and TempDb in SQL. Before we proceed I would like you to have a look at my previous blog to understand the various types of Collection Evaluations in ConfigMgr 2012.
Hope you are done reading my previous post. Let’s move on.
When a collection in ConfigMgr runs an evaluation, it uses the TempDb to create some temporary tables to process to insert the data based on what query we are using in Collection Rules. When I say Query, there are two types. WQL (WMI Query Language) and SQL (Structured Query Language).
In ConfigMgr we use the above two types. WQL is used by SMS Provider and SQL for Microsoft SQL Server.
Here is an example of a WQL and its equivalent SQL query for a Test collection created in ConfigMgr 2012 R2 to return all active clients.
WQL:selectSMS_R_SYSTEM.ResourceID,SMS_R_SYSTEM.ResourceType,SMS_R_SYSTEM.Name,SMS_R_SYSTEM.SMSUniqueIdentifier,SMS_R_SYSTEM.ResourceDomainORWorkgroup,SMS_R_SYSTEM.ClientfromSMS_R_SystemwhereSMS_R_System.Active="1"
SQL: select all SMS_R_SYSTEM.ItemKey,SMS_R_SYSTEM.DiscArchKey,SMS_R_SYSTEM.Name0,SMS_R_SYSTEM.SMS_Unique_Identifier0,SMS_R_SYSTEM.Resource_Domain_OR_Workgr0,SMS_R_SYSTEM.Client0fromvSMS_R_SystemASSMS_R_System whereSMS_R_System.Active0=N'1'
Above two statements looks similar. But they are not. You cannot run the WQL query in from SQL Management Studio. But you can execute the SQL statement.
You can see the WQL and SQL equivalent queries for any collection in SQL by running the below query. (Note: Don’t modify anything directly to table in SQL. This will impact the AdminUI functionality) Replace ‘P0000012’ with your collection ID.
select*fromCollection_Rules_SQLWhereCollectionIDin(selectCollectionIDfromCollectionswhereSiteID='P0000012')
When will the TempDb size grow and what is the impact with Collection Evaluation?
There are certain components in ConfigMgr uses TempDb. The important one is Collection Evaluator. Collection Evaluator is Single Threaded and run one collection evaluation at a time. The reason for this is that the next collection in the Evaluation Graph may be directly or indirectly depend on the collection getting evaluated.
By Default, the TempDb size is configured as below. But SQL Administrators, may have changed based on their required settings.
If we are using an Expensive query in a Collection with lot of joins and complex where clauses, it may start filling up the TempDb.
We are most likely to use “LIKE” and “NOT LIKE” statements in Collections to get our desired objects in the collection. According to the MSDN article“NOT LIKE” statements are Expensive and avoid this to improve SQL performance.
You can run the below Statement in SQL to identify what are all the collections in your environment really has “LIKE” and “NOT LIKE” in the queries.
selectSiteID,CollectionNamefromCollectionswhereCollectionIDin(selectCollectionIDfromCollection_Rules_SQLwhereSQLlike'%Like%'orSQLlike'%NOT LIKE%')
You will not see big Impact when you manage small number of systems with less number of collections. That’s why the collection query may work in your Test environment and may not give the expected result in Production environment.
When the Site is growing bigger and bigger, we will get lot of Data from clients and that puts lot of pressure in SQL.
Senthilkumar Pandurangan
Support Escalation Engineer | Microsoft System Center Configuration Manager.
Disclaimer: This posting is provided "AS IS" with no warranties and confers no rights