Utility of FetchSize and PageSize in Reader Spring Batch

这一生的挚爱 提交于 2021-02-08 07:21:04

问题


What is the difference between the propertie "FetchSize" and "PageSize" in Spring Batch ? The PageSize is the number of rows to retrieve at a time ? The FetchSize is number of DB calls ?

If my query return 10000 rows, what is the best setting ? If i put PageSize to 1000 and FetchSize to 1000, can you confirm i just need 10 calls for return all rows ? So if i upgrade the number of the propertie PageSize (for example 10.000), the number of DB call is just 1 so running time of the batch is better ?


回答1:


That's correct. With pageSize=1000 and fetchSize=500, there will be in theory 2 database calls to fetch a single page.

However, the fetchSize is just a hint to the database driver and can be ignored. So you need to check your database driver's documentation to make sure it behaves as expected in regards to this parameter.



来源:https://stackoverflow.com/questions/58041942/utility-of-fetchsize-and-pagesize-in-reader-spring-batch

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!