[hibernate-dev] Correlating Java 1.8 Streams and ScrollableResults with database cursors

Vlad Mihalcea mihalcea.vlad at gmail.com
Sat Nov 19 05:04:45 EST 2016


Hi,

I've noticed this new Jira ticket:

https://hibernate.atlassian.net/browse/HHH-11260

and I think we should correlate the Session#stream and Session#scroll with
database cursors.

While Oracle uses a fetch size of 10, and SQL Server uses an adaptive
cursor, PostgreSQL and MySQL just fetch the whole result set into the
client.

So, for MySQL we could do as suggested in the Jira ticket, by setting the
fetch size to Integer.MIN_VALUE.

My question is about PotgreSQL. Postgres requires setting the fetch size to
some positive value in order to turn the current statement into a database
cursor.
Now, should we set a default value for streaming (e.g. 10), which can be
controlled via a new config property:

hibernate.jdbc.stream.fetch_size

Let me know what you think.

Vlad


More information about the hibernate-dev mailing list