Recommendations for Indexing Meta Data Tables

Spring Batch provides DDL samples for the meta-data tables in the Core jar file for several common database platforms. Index declarations are not included in that DDL because there are too many variations in how users may want to index depending on their precise platform, local conventions and also the business requirements of how the jobs will be operated. The table below provides some indication as to which columns are going to be used in a WHERE clause by the Dao implementations provided by Spring Batch, and how frequently they might be used, so that individual projects can make up their own minds about indexing.

Table B.1. Where clauses in SQL statements (excluding primary keys) and their approximate frequency of use.
Default Table NameWhere ClauseFrequency
BATCH_JOB_INSTANCEJOB_NAME = ? and JOB_KEY = ?Every time a job is launched
BATCH_JOB_EXECUTIONJOB_INSTANCE_ID = ?Every time a job is restarted
BATCH_EXECUTION_CONTEXTEXECUTION_ID = ? and KEY_NAME = ?On commit interval, a.k.a. chunk
BATCH_STEP_EXECUTIONVERSION = ?On commit interval, a.k.a. chunk (and at start and end of step)
BATCH_STEP_EXECUTIONSTEP_NAME = ? and JOB_EXECUTION_ID = ?Before each step execution