Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make countStepExecutions access batch_job_execution only once #3876

Closed

Conversation

marschall
Copy link
Contributor

Change JdbcStepExecutionDao.COUNT_STEP_EXECUTIONS to access the table
batch_job_execution only once.

JdbcStepExecutionDao.COUNT_STEP_EXECUTIONS accesses batch_job_execution twice.

SELECT
    COUNT(*)
FROM
    batch_job_execution    je,
    batch_step_execution   se
WHERE
    se.job_execution_id IN (
        SELECT
            job_execution_id
        FROM
            batch_job_execution
        WHERE
            job_instance_id = ?
    )
    AND se.job_execution_id = je.job_execution_id
    AND se.step_name = ?;

there is no need for this, the query can be simlified to

SELECT
    COUNT(*)
FROM
         batch_job_execution je
    JOIN batch_step_execution se ON se.job_execution_id = je.job_execution_id
WHERE
        je.job_instance_id = ?
    AND se.step_name = ?;

Change JdbcStepExecutionDao.COUNT_STEP_EXECUTIONS to access the table
batch_job_execution only once.
fmbenhassine pushed a commit that referenced this pull request Jan 13, 2022
Change JdbcStepExecutionDao.COUNT_STEP_EXECUTIONS to access the
table batch_job_execution only once.

Issue #3876
fmbenhassine pushed a commit that referenced this pull request Jan 13, 2022
Change JdbcStepExecutionDao.COUNT_STEP_EXECUTIONS to access the
table batch_job_execution only once.

Issue #3876
@fmbenhassine
Copy link
Contributor

LGTM. Rebased and merged as 9710220. Thank you for your contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants