Domain Separation: Excessive number of rows in tables: cmdb_health_result and relation_health_result in instances where there is a large number of domainsDescriptionIf an instance has a lot of domains (>100), there is a chance that the tables like CMDB Health Result [cmdb_health_result] and CMDB Relation Health Results [relation_health_result] will be very large. An incident may be created from an alert generated by ServiceNow Monitoring System on Disk Growth on the database server hosting the database for your instance.CMDB Health Result [cmdb_health_result] and CMDB Relation Health Results [relation_health_result] are tables that contain the data for the widgets and scorecards of the CMDB Health dashboards. The data in these tables are populated by the jobs in Configuration > Health Preference > Scheduled Jobs.Due to the current design, the data related to CMDB Health dashboards are generated for each domain as the platform support the use of different rules for different domains. As such, if the number of domains is large, the data in the tables may be large as well. Out of the box, there is no entry in Table Cleaner (/sys_auto_flush_list.do) for these tables as the data is refreshed with each job execution.The jobs in Configuration > Health Preference > Scheduled Jobs may be running for a long time as well.Steps to Reproduce Note: This applies only to instances with Domain Separation 1. Add 1000 new domains with parent as TOP in the table used for domains eg sys_domain2. Make Assignment Group a recommended field for cmdb_ci class3. Run the Completeness Health JobWorkaroundServiceNow will be looking into the use case of supporting a large number of domains in a future release. In the meantime, the workaround to mitigate the large tables is to display the data for CMDB Health dashboards for the global domain only. Please refer to the following for the steps and test in a recently cloned subproduction instance before implementing in Production. a. Navigate to Configuration > Health Preference > Scheduled Jobs and disable the jobs by opening each of them in a new browser tab/window, uncheck the Active checkbox and click Save. b. Check that the jobs in Configuration > Health Preference > Scheduled Jobs are not running by navigating to System Diagnostics > Active Transactions (All Nodes). If they are running, terminate the jobs by following the steps in View and kill active transaction c. Support will truncate the following tables: relation_health_result cmdb_health_result cmdb_health_scorecard cmdb_health_metric_status cmdb_health_processor_statuscmdb_health_result_rel_all (this table may not exist, depending on the release) d. Check the table used for domain: Either navigate to Domain Admin > Configuration and look for value for "Domain Table" or execute the following in System Definition > Scripts - Background gs.print(GlideDomainSupport.getDomainTable()); e. With the domain table above, execute the following via System Definition > Scripts - Background. Depending on the number of domains in the instance, this script might take some time to complete. This script will create the corresponding records in CMDB Health Metric Preference [cmdb_health_metric_pref] table for all other parent domains (groups) and set active = false for these records. As these records are having active = false, data for the various metrics for all domains (besides the top domain) will not be collected when the jobs in Configuration > Health Preference > Scheduled Jobs run. This will provide relief for the excessive growth of tables: cmdb_health_result and relation_health_result. var rootDomains = [];getRootDomains(); // populate rootDomainsfor (var i = 0; i < rootDomains.length; i++) {disableMetrics(rootDomains[i]);}// switch back to globalGlideSession.get().setDomainID('global');function getRootDomains() {var gr = new GlideRecord('<Domain table in Step d>');gr.addNullQuery('parent');gr.query();while (gr.next()) {rootDomains.push(gr.getValue('sys_id'));}}function disableMetrics(domainID) {GlideSession.get().setDomainID(domainID);var mGr = new GlideRecord('cmdb_health_metric_pref');mGr.addQuery('sys_domain', 'global');mGr.query();while (mGr.next()) {mGr.setValue('active', 'false');mGr.update();}} f. Navigate to Configuration > Health Preference > Scheduled Jobs and enable the jobs listed by opening each of them in a new browser tab/window, check the Active checkbox and click Save. You can wait for the jobs to run or you can manually run them by clicking Execute Now. g. When all jobs have completed, please check that the status in CMDB Health Metric Status [cmdb_health_metric_status]. The staus should be: "Complete". If the status is not "Complete", please refer to the documentation - CMDB Health troubleshooting to troubleshoot accordingly. h. Navigate to Configuration > CMDB Dashboard > CMDB View and check that the widgets are displaying data only when accessed from the global domain. When accessed in other domains, the widgets may not display any data. Related Problem: PRB1323262