On 2016-10-20 09:55, Tsunakawa, Takayuki wrote:
> Hello,
>
> Let me ask your opinion on whether the default value of
> defaultRowFetchSize can or should be changed. The current default
> value is 0, which means the driver fetches all rows at once when the
> result set is opened. I'd like to propose changing it to some small
> positive value because:
>
> * It sometimes causes out-of-memory trouble when users' batch apps
> process many rows on the client side. They are often not aware of the
> fetch size, because they didn't experience the problem with the same
> app when using Oracle. Oracle's default fetch size is 10. They
> complained about the PostgreSQL's behavior. (OTOH, MySQL's JDBC driver
> fetches all rows by default like PostgreSQL.)
>
> * If the performance is better when the fetch size is 0, then those
> who are keen to improve performance can find the method for tuning
> fetch size. I think it would be better to make the default setting
> more friendly for people who aren't so conscious of tuning.
Note that - with some between the lines reading of the JDBC API +
specification, fetchSize 0 means: use driver default.
I infer this from setFetchSize:
> If the value specified is zero, then the hint is ignored. The default
> value is zero.
and getFetchSize:
> If this Statement object has not set a fetch size by calling the
> method setFetchSize, the return value is implementation-specific.
In other words, the default fetch size is zero (setFetchSize), and if
setFetchSize has never been called, then the default fetch size is
implementation-specific, which to my interpretation mean 0 ->
implementation-specific default
In other words, PostgreSQL JDBC could leave the default at 0, but then
use a default fetch size.
Mark