profiler.stop();
profiler.start("deleteAnalyses (project_measures)");
- analysisIdsPartitions.forEach(analysisIdsPartition -> {
- purgeMapper.deleteSnapshotMeasures(analysisIdsPartition);
- for (Long analysisId : analysisIdsPartition) {
- List<List<Long>> snapshotIdPartitions = Lists.partition(purgeMapper.selectDescendantsSnapshotIds(analysisId), MAX_SNAPSHOTS_PER_QUERY);
- snapshotIdPartitions.forEach(purgeMapper::deleteSnapshotMeasures);
- }
- });
+ analysisUuidsPartitions.forEach(purgeMapper::deleteAnalysisMeasures);
session.commit();
profiler.stop();
*/
List<IdUuidPair> selectComponentsByProjectUuid(String projectUuid);
- List<Long> selectDescendantsSnapshotIds(@Param("analysisId") long analysisId);
-
void deleteAnalyses(@Param("analysisUuids") List<String> analysisUuids);
void deleteDescendantSnapshots(@Param("snapshotIds") List<Long> snapshotIds);
void deleteSnapshotEvents(@Param("analysisUuids") List<String> analysisUuids);
+ void deleteAnalysisMeasures(@Param("analysisUuids") List<String> analysisUuids);
+
void deleteSnapshotMeasures(@Param("snapshotIds") List<Long> snapshotIds);
List<Long> selectMetricIdsWithoutHistoricalData();
select id, uuid from projects where project_uuid=#{uuid} or uuid=#{uuid}
</select>
- <select id="selectDescendantsSnapshotIds" resultType="long" parameterType="long">
- select id from snapshots where root_snapshot_id=#{analysisId}
- </select>
+ <delete id="deleteAnalysisMeasures" parameterType="map">
+ delete from project_measures
+ where
+ analysis_uuid in
+ <foreach collection="analysisUuids" open="(" close=")" item="analysisUuid" separator=",">
+ #{analysisUuid}
+ </foreach>
+ </delete>
<delete id="deleteSnapshotMeasures" parameterType="map">
delete from project_measures