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

Add tests with LIMIT ... OFFSET queries and benchmark them #144

Open
Ngalstyan4 opened this issue Sep 16, 2023 · 0 comments
Open

Add tests with LIMIT ... OFFSET queries and benchmark them #144

Ngalstyan4 opened this issue Sep 16, 2023 · 0 comments

Comments

@Ngalstyan4
Copy link
Contributor

Ngalstyan4 commented Sep 16, 2023

docs: https://www.postgresql.org/docs/current/queries-limit.html
context: https://news.ycombinator.com/reply?id=37501161&goto=item%3Fid%3D37499375%2337501161

Consider a scenario where I retrieve and render X elements from the table for my first page of database results and allow the user to page into N other pages of X results each. Assume there is P% chance the user will naviate to the page i+1 given they are on page i.

What is the best strategy from the app developers perspective here? (options below)

  1. Query the database for the first page and then query the database again via LIMIT...OFFSET for each next page
  2. Prefetch results for M pages and only access the database on the first page

It would be great if benchmarking gave some insight into how to navigate this situation.

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