]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-18729 Optimize ce_queue peek query by changing 'not exists' to 'left join'...
authorJacek Poreda <jacek.poreda@sonarsource.com>
Thu, 16 Mar 2023 15:27:56 +0000 (16:27 +0100)
committersonartech <sonartech@sonarsource.com>
Mon, 20 Mar 2023 20:02:58 +0000 (20:02 +0000)
server/sonar-db-dao/src/main/resources/org/sonar/db/ce/CeQueueMapper.xml

index 9aebba149fb813bd47d7f3ded79100f9948f6a58..0e33cabba689e7615a17fe71fc48c652942da064 100644 (file)
     <if test="excludeViewRefresh">
         left join components c on c.uuid = cq.main_component_uuid and c.qualifier &lt;&gt; 'VW'
     </if>
+      left join ce_queue cq2 on cq.main_component_uuid=cq2.main_component_uuid and cq2.status &lt;&gt;'PENDING'
     where
       cq.status='PENDING'
       and cq.started_at is null
+      and cq2.uuid is null
       <if test="excludeIndexationJob">
         and cq.task_type &lt;&gt; 'ISSUE_SYNC'
       </if>
-      and not exists (
-        select
-          1
-        from
-          ce_queue cq2
-        where
-          cq.main_component_uuid=cq2.main_component_uuid
-          and cq2.status &lt;&gt; 'PENDING'
-      )
   </sql>
 
   <sql id="orderBySelectEligibleForPeek">