Skip to content

Commit

Permalink
fix: query performance
Browse files Browse the repository at this point in the history
  • Loading branch information
Nolife999 committed Nov 20, 2023
1 parent 43091be commit 16ae5cf
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,9 @@ private void queryUpdateArchiveWithoutFileName(StringBuilder requete) {
* @return
*/
private StringBuilder querySelectFilesMarkedToReplay() {
return new StringBuilder("select distinct " + ColumnEnum.ID_SOURCE.getColumnName() + " from " + this.tablePil
+ " a where to_delete='R' and exists (select 1 from " + this.tablePilTemp + " b where a."
return new StringBuilder("SELECT " + ColumnEnum.ID_SOURCE.getColumnName() + " FROM (SELECT DISTINCT "
+ ColumnEnum.ID_SOURCE.getColumnName() + " FROM " + this.tablePil
+ " where to_delete='R') a WHERE exists (select 1 from " + this.tablePilTemp + " b where a."
+ ColumnEnum.ID_SOURCE.getColumnName() + "=b." + ColumnEnum.ID_SOURCE.getColumnName() + ")");
}

Expand Down Expand Up @@ -309,8 +310,7 @@ public void execQueryInsertCorruptedArchiveInPilotage(FilesDescriber content) th
UtilitaireDao.get(0).executeImmediate(this.sandbox.getConnection(), requete);
}


public void execQueryVersionDuplicateArchives (List<String> listContainerDoublons,
public void execQueryVersionDuplicateArchives(List<String> listContainerDoublons,
List<String> listVersionContainerDoublons) throws ArcException {
StringBuilder requete = new StringBuilder();

Expand All @@ -320,11 +320,11 @@ public void execQueryVersionDuplicateArchives (List<String> listContainerDoublon
requete.append(
"from (select distinct container from " + this.tablePilTemp + " where container is not null) a ");

GenericBean m = new GenericBean(UtilitaireDao.get(0)
.executeRequest(sandbox.getConnection(), new ArcPreparedStatementBuilder(requete)));
GenericBean m = new GenericBean(
UtilitaireDao.get(0).executeRequest(sandbox.getConnection(), new ArcPreparedStatementBuilder(requete)));
listContainerDoublons.addAll(m.getColumnValues(ColumnEnum.CONTAINER.getColumnName()));
listVersionContainerDoublons.addAll(m.getColumnValues(ColumnEnum.V_CONTAINER.getColumnName()));

}

}

0 comments on commit 16ae5cf

Please sign in to comment.