Improve DB qeury performance to get all projects in namespace for security policies
Description
While working on Add migration to re-sync scan result policies f... (!116608 - merged) we noticed that the query to get all projects in a namespace from security_orchestration_policy_configuration
was not efficient for namespaces that has a lot of projects. InOperatorOptimization
was suggested to improve the query.
We use the same inefficient query in 2 places:
Security::SecurityOrchestrationPolicies::SyncScanResultPoliciesService
Security::OrchestrationPolicyRuleScheduleNamespaceWorker
We looked into using InOperatorOptimization
but it didn't improve the query performance (!138647 (closed)).
We will try to find other ways to improve it.
Edited by Andy Schoenen