aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-db/src/main/resources/org/sonar/db
diff options
context:
space:
mode:
authorTeryk Bellahsene <teryk.bellahsene@sonarsource.com>2017-01-25 16:39:07 +0100
committerTeryk Bellahsene <teryk.bellahsene@sonarsource.com>2017-01-25 16:39:07 +0100
commit35485c876e9929e256a953f1fe20e726e5bbc915 (patch)
treea48648d03b82d101daf6befcd37b34452fb4deee /sonar-db/src/main/resources/org/sonar/db
parent3e43924e631f72a35353525e74530f8e66f22ef3 (diff)
downloadsonarqube-35485c876e9929e256a953f1fe20e726e5bbc915.tar.gz
sonarqube-35485c876e9929e256a953f1fe20e726e5bbc915.zip
SONAR-7305 Improve performances of WS api/measures/search_history
Diffstat (limited to 'sonar-db/src/main/resources/org/sonar/db')
-rw-r--r--sonar-db/src/main/resources/org/sonar/db/measure/MeasureMapper.xml14
1 files changed, 10 insertions, 4 deletions
diff --git a/sonar-db/src/main/resources/org/sonar/db/measure/MeasureMapper.xml b/sonar-db/src/main/resources/org/sonar/db/measure/MeasureMapper.xml
index c56d91b0cb5..2a75e4a422c 100644
--- a/sonar-db/src/main/resources/org/sonar/db/measure/MeasureMapper.xml
+++ b/sonar-db/src/main/resources/org/sonar/db/measure/MeasureMapper.xml
@@ -142,12 +142,18 @@
<select id="selectPastMeasuresOnSeveralAnalyses" parameterType="map" resultType="Measure">
select <include refid="measureColumns"/>
from project_measures pm
- inner join snapshots analysis on analysis.uuid = pm.analysis_uuid
+ inner join snapshots analysis on analysis.uuid = pm.analysis_uuid
where
- pm.component_uuid = #{componentUuid}
- and analysis.uuid in <foreach item="analysisUuid" collection="analysisUuids" open="(" separator="," close=")">#{analysisUuid}</foreach>
- and pm.metric_id in <foreach item="metricId" collection="metricIds" open="(" separator="," close=")">#{metricId}</foreach>
+ pm.component_uuid = #{query.componentUuid, jdbcType=VARCHAR}
+ <if test="query.from!= null">
+ and analysis.created_at>=#{query.from, jdbcType=BIGINT}
+ </if>
+ <if test="query.to!=null">
+ and analysis.created_at&lt;#{query.to, jdbcType=BIGINT}
+ </if>
+ and pm.metric_id in <foreach item="metricId" collection="query.metricIds" open="(" separator="," close=")">#{metricId, jdbcType=VARCHAR}</foreach>
and pm.person_id is null
+ and analysis.status=#{query.status, jdbcType=VARCHAR}
</select>
<select id="selectProjectMeasuresOfDeveloper" parameterType="map" resultType="Measure">