Reader Spring Batch中FetchSize和PageSize的实用程序 [英] Utility of FetchSize and PageSize in Reader Spring Batch

查看:84
本文介绍了Reader Spring Batch中FetchSize和PageSize的实用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Spring Batch中的属性"FetchSize"和"PageSize"有什么区别?PageSize是一次要检索的行数吗?FetchSize是数据库调用的数量吗?

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 ?

如果我的查询返回10000行,最佳设置是什么?如果我将PageSize设置为1000,将FetchSize设置为1000,可以确认我只需要10次调用即可返回所有行吗?因此,如果我升级属性PageSize的数量(例如10.000),则数据库调用的数量仅为1,因此批处理的运行时间更好?

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 ?

推荐答案

是正确的.在 pageSize = 1000 fetchSize = 500 的情况下,理论上将有2个数据库调用来获取单个页面.

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

但是, fetchSize 只是数据库驱动程序的提示,可以忽略.因此,您需要检查数据库驱动程序的文档,以确保其在此参数方面的行为符合预期.

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.

这篇关于Reader Spring Batch中FetchSize和PageSize的实用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆