2

I am new to jOOQ and consider replacing some JDBC code with jOOQ.

Looking at the jOOQ Java 8 streams is examples I start wondering if I can get a performance improvement by using jOOQ.

I have a PostgreSQL query with this characteristics: Merge Join (cost=1.34..7649.90 rows=30407 width=333) (actual time=0.042..46.644 rows=28264 loops=1)

At the database the server the first row is returned after 0.042 ms while the last row is returned after 46.644 ms.

But my JDBC does not return the ResultSet until it is complete.

Is jOOQ (with Java 8 streams) able to start handling tuples as soon as the are ready or is jOOQ limited by JDBC?

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197

1 Answers1

2

jOOQ's Java 8 integration has two methods that might be interesting to you:

As of jOOQ 3.8, both APIs are limited by the blocking nature of the underlying JDBC API, i.e. both APIs internally iterate on ResultSet.next().

In particular, you can turn on using server side cursors by setting:

// JDBC
statement.setFetchSize(50);

// jOOQ, which delegates this call to JDBC
quest.fetchSize(50);

See also Statement.setFetchSize() or this question for more details.

Community
  • 1
  • 1
Lukas Eder
  • 211,314
  • 129
  • 689
  • 1,509