title: How JDBCPagingItemReader fetches data
body: <p>I am working on a batch job where I am using step partitioning and JDBCPagingItemReader used for data fetching with page size 100, thread count 5. I ran the program in debug mode for 3000 records in DB and found each of the thread is firing the below query to get the data from database.</p>
  
  <p>SELECT * FROM ( SELECT CASE_NUM, STTS_CD, UPDT_TS, OFC_CD, OFC_NUM, CHNL_CD, APRV_OFC_CD, APRV_OFC_NUM,TYP_CD, ROW_NUMBER() OVER(ORDER BY CASE_NUM) AS rownumber FROM T_CASE WHERE PROC_INDX ='P' ) AS data WHERE rownumber BETWEEN :fromRow AND :toRow ORDER BY rownumber ASC FETCH FIRST 100 ROWS ONLY</p>
  
  <p>My question is </p>
  
  <p>1) If commit interval is 1 (This is because of my business requirement), then once the 100 record are processed by any thread then that thread will fire another query to get the next chunk of 100 records or it will keep firing the query and caches the data?</p>
  
  <p>2) There would be only 5 thread * 100 chunk = 500 active records in memory at any certain point of time?</p>
  
  <p>3) I am using in memory job repository. Is there any guidelines or best practices to avoid any OutOfMemoryError in such cases?</p>
  
  <p>Expert seeking your help here. Thanks in advance!</p>