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

Using LIMIT OFFSET for paging cursor results #100

Closed
2 tasks
chauhan-abhi opened this issue Dec 9, 2021 · 1 comment
Closed
2 tasks

Using LIMIT OFFSET for paging cursor results #100

chauhan-abhi opened this issue Dec 9, 2021 · 1 comment

Comments

@chauhan-abhi
Copy link

chauhan-abhi commented Dec 9, 2021

⚠️ Please describe your feature request

Is it like we are always fetching all records and then moving the cursor to our page limit and offset in the library..
Why are we not fetching only that many records using LIMIT and OFFSET?

💡 Describe the solution you'd like

📊 Describe alternatives you've considered

📄 Additional context

🙋 Do you want to develop this feature yourself?

  • Yes
  • No
@bojankoma bojankoma self-assigned this Dec 17, 2021
@bojankoma bojankoma added this to the 5.4.2 milestone Dec 17, 2021
@bojankoma
Copy link
Collaborator

@chauhan-abhi Hi, thank you for opening this issue and asking a very tricky question. :)
In short, a cursor implementation has been chosen over offset pagination in order to optimize for large data sets.
I can see that the logger showing SELECT * messages in console has been very misleading, so I will remove it in following release. Furthermore, this cursor implementation just creates a pointer to exact position and reads N fields from it, in comparison with offset pagination where you actually read rows and then truncate the output.

For more details about different pagination approaches, you can go here on this excellent Slack blog post.

Nevertheless, if you think a different approach would be a better one, a PR is most welcome and we can discuss it further.

@bojankoma bojankoma removed this from the 5.4.2 milestone Dec 18, 2021
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

2 participants