Reputation: 2888
How does fetchLazy
work in jooq?
Is it equivalent to doing paginated select with limit and offset?
Upvotes: 3
Views: 791
Reputation: 220842
They're different.
fetchLazy()
... returns a Cursor
type, which is jOOQ's equivalent of the JDBC ResultSet
type. The query will fully materialise in the database, but jOOQ (JDBC) will fetch rows one-by-one. This is useful
fetch()
, which loads all rows from the server in one go.LIMIT .. OFFSET
... will reduce the number of returned rows already in the database, without them ever surfacing in the client. This can heavily improve execution speed in the server, as the server
LIMIT
Upvotes: 2