From: | Jorge Solórzano <jorsol(at)gmail(dot)com> |
---|---|
To: | Mark Rotteveel <mark(at)lawinegevaar(dot)nl> |
Cc: | Vladimir Sitnikov <sitnikov(dot)vladimir(at)gmail(dot)com>, List <pgsql-jdbc(at)postgresql(dot)org> |
Subject: | Re: [RFC] How about changing the default value of defaultRowFetchSize? |
Date: | 2016-10-20 18:30:32 |
Message-ID: | CA+cVU8NZYCzUwWC17DtY91Gom_StG=yQZvtATN82rddJLp6HtA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
On Thu, Oct 20, 2016 at 11:55 AM, Mark Rotteveel <mark(at)lawinegevaar(dot)nl>
wrote:
> On 20-10-2016 19:30, Jorge Solórzano wrote:
>
>> So if the driver internally handle fetch size 0 == fetch size 100,
>> that's what i call an hidden inconsistent behavior.
>>
>> Don't get me wrong, it make sense to switch defaultRowFetchSize to
>> "100", but a call to getFetchSize() should be == 100, not 0.
>>
>
> And that is how it should work, however according to the JDBC
> specification (or at least: that is how I read it),
> Statement.setFetchSize(0) means "use driver default fetch size".
>
To how I read the api (http://docs.oracle.com/javase/7/docs/api/java/sql/
Statement.html#setFetchSize(int)):
"If the value specified is zero, then the hint is ignored. The default
value is zero."
It don't really said "use default fetch size", it said the hint is ignored.
IMO the api is a little ambiguous but the api and specification in "*13.5
Performance Hints*" reads:
>
>
> *The methods getFetchDirection and getFetchSize return the current value
> of thehints. If either of these methods is called before the corresponding
> setter method hasbeen called, the value returned is implementation-defined.*
>
So is up to drivers choice what to return as "default"
if a setFetchSize is not called, so again IMO it should return 100 not 0.
Anyway, as Dave mentioned, this is just a "hint", and most apps need a
certain scenario to actually use it (autocommit=off, type_forward_only,
single statement). "What we do inside the driver is our business" is fine
as long as you stick with the standard.
> On the other hand, drivers are also free to ignore fetch size hints.
>
> Mark
> --
> Mark Rotteveel
>
From | Date | Subject | |
---|---|---|---|
Next Message | Brad DeJong | 2016-10-20 20:20:34 | setCharacterStream(int, Reader) |
Previous Message | Mark Rotteveel | 2016-10-20 17:55:51 | Re: [RFC] How about changing the default value of defaultRowFetchSize? |