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

Infinite Scrolling #2

Open
belst opened this issue Apr 11, 2018 · 1 comment
Open

Infinite Scrolling #2

belst opened this issue Apr 11, 2018 · 1 comment

Comments

@belst
Copy link
Contributor

belst commented Apr 11, 2018

Queries my dude:

Initial:

SELECT * FROM videos
ORDER BY created_at DESC, id DESC -- latest on top
LIMIT 50; -- 50 = pagesize

later: query with ?after_date=<latest_created_at>&after_id=<latest_id>

SELECT * FROM videos
WHERE (created_at, id) < (<latest_created_at>, <latest_id>)
ORDER BY created_at DESC, id DESC
LIMIT 50;

Disadvantages: cannot jump to specific page.
Advantages: very fast and perfect for infinite scrolling

@belst
Copy link
Contributor Author

belst commented Jul 30, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant