-
Notifications
You must be signed in to change notification settings - Fork 6
Closed
Description
For SELECT queries with large number of result rows, it is nice to have an application level NyQLResult
iterator. Like below.
// additional second parameter, 50, means we expect result 50 rows per page.
Iterator<NyQLResult> paginator = nyqlInstance.paginate('script/path', 50, data).iterator();
while (paginator.hasNext()) {
// this result has 50 rows unless it is the last page in the whole result set
NyQLResult page = paginator.next();
// do something with result...
}
NOTE: This method will NOT manipulate database cursors. But we use JDBC setFetchSize()
to efficiently fetch limited number of records to the memory at once, rather bringing all result rows into application memory. Each fetched rows will be returned to user for processing and then only loads the next block of rows.