Skip to content

Application level pagination for SELECT queries #46

@isuru89

Description

@isuru89

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.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions