-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Bad performance of GET_LAST_STEP_EXECUTION query on DB2 with large STEP_EXECUTION table #4657
Comments
Thank you for reporting this!
This would revert 62a8f44, which moved the sorting logic from the java side to the database (for performance reason, see commit message and removed code in that change set). What we can explore is adding a |
It only reverts a small portion from that commit. Before that change, there was an N+1 problem. First, it queried all the job executions, and then for each job execution it queried all steps. I would not expect that moving just this ordering logic from the DB to the java side would generally hurt performance too much.
|
Fixes spring-projects#4657. This addresses performance issues with large STEP_EXECUTION table on DB2.
This addresses performance issues with large STEP_EXECUTION table on DB2. Fixes #4657
This addresses performance issues with large STEP_EXECUTION table on DB2. Fixes spring-projects#4657 Signed-off-by: Fabrice Bibonne <[email protected]>
Bug description
We are migrating from Spring Batch 3.x to 5.x and are experiencing performance issues (long delays between each step).
This is on DB2, with a quite large STEP_EXECUTION table (50 million records).
After some digging, I found this to be caused by the GET_LAST_STEP_EXECUTION query, introduced in 62a8f44.
Environment
Spring Batch 5.1.2, Java 21, DB2 v10.5.
Our DBA has not been able to find a solution to improve the performance with an additional index.
What we did find out is that, by removing the ORDER BY, we get the result (typically just a single row in the normal case) in a matter of milliseconds. But with the ORDER BY, it takes ~ 60 seconds.
So a possible workaround would be to remove the ORDER BY and perform the sorting on the java side.
That is something I am currently trying out with the approach of overriding
JdbcStepExecutionDao#getLastStepExecution
with a custom implementation as described here. Note that overridingJdbcStepExecutionDao#getLastStepExecution
is not trivial though. NeitherJdbcStepExecutionDao
norJobRepositoryFactoryBean
are very inheritance-friendly.The text was updated successfully, but these errors were encountered: