DiscoveryAWSRelationshipSensor script include can spend significant time iterating over data from cmdb_rel_ci causing scheduled job latency/worker thread contentionDescription'ASYNC: Discovery – Sensors AWS Relations' scheduled jobs execute code from the DiscoveryAWSRelationshipSensor script include. This script include performs a query against the cmdb_rel_ci table which, in some circumstances, can return a large number of results. The script include then iterates over these results which can cause latency/the scheduled job to execute for a long time.Steps to Reproduce Execute the corresponding AWS discovery schedules in an instance with large volumes of corresponding data in the cmdb_rel_ci table.Observe that the resulting 'ASYNC: Discovery – Sensors AWS Relations' scheduled jobs are slow.Workaroundhttps://community.servicenow.com/community?id=community_article&sys_id=093a5bc7db072010fb115583ca961995 The workaround is unavailable apart from porting the fix to the desired release, on-demand, because the fix involves in multiple lines changes related to the code and query optimizations.Related Problem: PRB1479781