Re: [RFC] How about changing the default value of defaultRowFetchSize?

From: Dave Cramer <pg(at)fastcrypt(dot)com>
To: "Tsunakawa, Takayuki" <tsunakawa(dot)takay(at)jp(dot)fujitsu(dot)com>
Cc: Jorge Solórzano <jorsol(at)gmail(dot)com>, Vitalii Tymchyshyn <vit(at)tym(dot)im>, Mark Rotteveel <mark(at)lawinegevaar(dot)nl>, List <pgsql-jdbc(at)postgresql(dot)org>, Vladimir Sitnikov <sitnikov(dot)vladimir(at)gmail(dot)com>
Subject: Re: [RFC] How about changing the default value of defaultRowFetchSize?
Date: 2016-10-25 10:57:13
Message-ID: CADK3HHJJ0TVmu_2k0C+piyGOvtC8qJjK8ywJtU_MSE6T-xnvjw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

On 24 October 2016 at 23:15, Tsunakawa, Takayuki <
tsunakawa(dot)takay(at)jp(dot)fujitsu(dot)com> wrote:

> From: davecramer(at)gmail(dot)com [mailto:davecramer(at)gmail(dot)com] On Behalf Of
> > Dave Cramer
> > This is what I take issue with. It should return 0 which means that it
> has
> > not been set. What use is it to the user ?
>
> I'm sorry to repeat myself. According to the API doc, the use of
> getFetchSize() is to retrieve the number of result set rows, not the hint
> value. So, I thought 0 was not appropriate because 0 is only a valid hint
> value passed to setFetchSize(). Which sentence in what document does your
> returning 0 follow?
>
> http://docs.oracle.com/javase/7/docs/api/java/sql/Statement.html
>
> Retrieves the number of result set rows that is the default fetch size for
> ResultSet objects generated from this Statement object.

>
> *If this Statement object has not set a fetch size by calling the method
> setFetchSize, the return value is implementation-specific.*

This states that if setFetchSize has not been called then we return what we
want. Given that if the statement is in auto-commit then the fetch size is
irrelevant. The correct logic would be if autocommit=false then return the
default value, otherwise 0, but I'm not advocating this either.

So my question to you is how would you use this information anyway? It's
not like you can allocate more memory or something to accommodate the rows.
It makes more sense to me that if I get 0 back then I know I have to set
it. If I get the value back that I set it to then I know what's going on. I
would assert that anyone that is knowledgable enough to use this is going
to call setFetchSize.

Dave Cramer

davec(at)postgresintl(dot)com
www.postgresintl.com

>

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Ziyun Audrey Wang 2016-10-25 16:45:06 postgresql support new time zone TRT
Previous Message Amit Kapila 2016-10-25 08:15:52 Re: Patch: Implement failover on libpq connect level.