aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJacek Poreda <jacek.poreda@sonarsource.com>2023-03-16 16:27:56 +0100
committersonartech <sonartech@sonarsource.com>2023-03-20 20:02:58 +0000
commit6e43a98176f4f231f306dbbd19077bf3cda7d1b9 (patch)
tree01fc4301fdcdb6a3f6cd8b1eb91601ea91271abd
parent3858bedeb66f213e01e9a39165e6c384d9913049 (diff)
downloadsonarqube-6e43a98176f4f231f306dbbd19077bf3cda7d1b9.tar.gz
sonarqube-6e43a98176f4f231f306dbbd19077bf3cda7d1b9.zip
SONAR-18729 Optimize ce_queue peek query by changing 'not exists' to 'left join' with condition
-rw-r--r--server/sonar-db-dao/src/main/resources/org/sonar/db/ce/CeQueueMapper.xml11
1 files changed, 2 insertions, 9 deletions
diff --git a/server/sonar-db-dao/src/main/resources/org/sonar/db/ce/CeQueueMapper.xml b/server/sonar-db-dao/src/main/resources/org/sonar/db/ce/CeQueueMapper.xml
index 9aebba149fb..0e33cabba68 100644
--- a/server/sonar-db-dao/src/main/resources/org/sonar/db/ce/CeQueueMapper.xml
+++ b/server/sonar-db-dao/src/main/resources/org/sonar/db/ce/CeQueueMapper.xml
@@ -182,21 +182,14 @@
<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">