Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Application level pagination for SELECT queries #46

Closed
isuru89 opened this issue Sep 28, 2017 · 0 comments
Closed

Application level pagination for SELECT queries #46

isuru89 opened this issue Sep 28, 2017 · 0 comments
Assignees
Milestone

Comments

@isuru89
Copy link
Contributor

isuru89 commented Sep 28, 2017

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.

@isuru89 isuru89 added this to the v2.0 milestone Sep 28, 2017
@isuru89 isuru89 self-assigned this Sep 28, 2017
isuru89 added a commit that referenced this issue Oct 6, 2017
@isuru89 isuru89 closed this as completed Oct 25, 2017
isuru89 added a commit that referenced this issue May 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant