Skip to content

Commit

Permalink
feat: always merge vacuum with an analyze
Browse files Browse the repository at this point in the history
  • Loading branch information
Nolife999 committed Nov 25, 2024
1 parent ad1cb50 commit 903c785
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ public static void maintenancePilotage(Connection coordinatorConnection, String

try {
UtilitaireDao.get(0).executeImmediate(coordinatorConnection, FormatSQL.vacuumSecured(tablePil, type));
UtilitaireDao.get(0).executeImmediate(coordinatorConnection, FormatSQL.analyzeSecured(tablePil));
} catch (Exception e) {
StaticLoggerDispatcher.error(LOGGER, "Error in ApiService.maintenancePilotage");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,8 @@ public boolean execQueryIsStillSomethingToDelete() throws ArcException
public void execQueryMaintenancePilotage() throws ArcException
{
StringBuilder query = new StringBuilder();
query.append(FormatSQL.vacuumSecured(ViewEnum.PILOTAGE_FICHIER.getFullName(sandbox.getSchema()), FormatSQL.VACUUM_OPTION_ANALYZE));
query.append(FormatSQL.vacuumSecured(ViewEnum.PILOTAGE_ARCHIVE.getFullName(sandbox.getSchema()), FormatSQL.VACUUM_OPTION_FREEZE));
query.append(FormatSQL.analyzeSecured(ViewEnum.PILOTAGE_ARCHIVE.getFullName(sandbox.getSchema())));

query.append(FormatSQL.vacuumSecured(ViewEnum.PILOTAGE_FICHIER.getFullName(sandbox.getSchema()), FormatSQL.VACUUM_OPTION_NONE));
query.append(FormatSQL.vacuumSecured(ViewEnum.PILOTAGE_ARCHIVE.getFullName(sandbox.getSchema()), FormatSQL.VACUUM_OPTION_FREEZE));
UtilitaireDao.get(0).executeImmediate(sandbox.getConnection(), query);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,6 @@ public static void rebuildPilotageDao(Connection connexion, String envExecution)
String tablePilotage = ViewEnum.PILOTAGE_FICHIER.getFullName(envExecution);

UtilitaireDao.get(0).executeImmediate(connexion, FormatSQL.vacuumSecured(tablePilotage, FormatSQL.VACUUM_OPTION_FREEZE));

UtilitaireDao.get(0).executeImmediate(connexion, FormatSQL.analyzeSecured(tablePilotage));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -748,7 +748,6 @@ public void maintenancePgCatalog(Connection connexion, String type) {
StringBuilder requete = new StringBuilder();
for (String t : gb.mapContent().get("tablename")) {
requete.append(FormatSQL.vacuumSecured(t, type));
requete.append(FormatSQL.analyzeSecured(t));
}
executeImmediate(connexion, requete.toString());
} catch (Exception ex) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ private FormatSQL() {
public static final String VACUUM_OPTION_NONE = "";
public static final String VACUUM_OPTION_FREEZE = "freeze";
public static final String VACUUM_OPTION_FULL = "full";
public static final String VACUUM_OPTION_ANALYZE = "analyze";


private static final Logger LOGGER = LogManager.getLogger(FormatSQL.class);

Expand Down Expand Up @@ -186,7 +184,7 @@ public static GenericPreparedStatementBuilder tryQueryAndReport(GenericPreparedS
* @return
*/
public static String vacuumSecured(String table, String type) {
return "VACUUM " + type + " " + table + "; COMMIT; \n";
return "VACUUM " + type + " ANALYZE " + table + "; COMMIT; \n";
}

/**
Expand Down

0 comments on commit 903c785

Please sign in to comment.