Open belst opened 6 years ago
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>
?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
standard pagination: https://github.com/diesel-rs/diesel/blob/v1.3.0/examples/postgres/advanced-blog-cli/src/pagination.rs
Queries my dude:
Initial:
later: query with
?after_date=<latest_created_at>&after_id=<latest_id>
Disadvantages: cannot jump to specific page. Advantages: very fast and perfect for infinite scrolling