From fbbf996c7bb8703bb5de610e8c2b659a2e736a17 Mon Sep 17 00:00:00 2001 From: Philippe Marschall Date: Sun, 28 Mar 2021 17:51:40 +0200 Subject: [PATCH] Make countStepExecutions access batch_job_execution only once Change JdbcStepExecutionDao.COUNT_STEP_EXECUTIONS to access the table batch_job_execution only once. --- .../batch/core/repository/dao/JdbcStepExecutionDao.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/JdbcStepExecutionDao.java b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/JdbcStepExecutionDao.java index d5712fa227..f740d8673a 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/JdbcStepExecutionDao.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/JdbcStepExecutionDao.java @@ -107,11 +107,9 @@ public class JdbcStepExecutionDao extends AbstractJdbcBatchMetadataDao implement "STEP_EXECUTION_ID=?"; private static final String COUNT_STEP_EXECUTIONS = "SELECT COUNT(*) " + - " from %PREFIX%JOB_EXECUTION JE, %PREFIX%STEP_EXECUTION SE" + - " where " + - " SE.JOB_EXECUTION_ID in (SELECT JOB_EXECUTION_ID from %PREFIX%JOB_EXECUTION " + - "where JOB_INSTANCE_ID = ?)" + - " and SE.JOB_EXECUTION_ID = JE.JOB_EXECUTION_ID " + + " from %PREFIX%JOB_EXECUTION JE JOIN %PREFIX%STEP_EXECUTION SE " + + " on SE.JOB_EXECUTION_ID = JE.JOB_EXECUTION_ID " + + "where JE.JOB_INSTANCE_ID = ?" + " and SE.STEP_NAME = ?"; private int exitMessageLength = DEFAULT_EXIT_MESSAGE_LENGTH;