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

Embed all necessary data in pagination cursors #4982

Open
5 tasks done
dullbananas opened this issue Aug 17, 2024 · 2 comments
Open
5 tasks done

Embed all necessary data in pagination cursors #4982

dullbananas opened this issue Aug 17, 2024 · 2 comments

Comments

@dullbananas
Copy link
Collaborator

Requirements

  • Is this a feature request? For questions or discussions use https://lemmy.ml/c/lemmy_support
  • Did you check to see if this issue already exists?
  • Is this only a feature request? Do not put multiple feature requests in one issue.
  • Is this a backend issue? Use the lemmy-ui repo for UI / frontend issues.
  • Do you agree to follow the rules in our Code of Conduct?

Is your proposal related to a problem?

Using the ID makes an additional database query necessary and doesn't work if the referenced item is purged

Describe the solution you'd like.

For the pagination cursor, instead of using the ID, use the json serialization or something similar of the cursor data struct (currently it's the whole aggregates struct)

Describe alternatives you've considered.

Only include the fields used by the selected sort type (more complicated)

Additional context

No response

@phiresky
Copy link
Collaborator

phiresky commented Aug 18, 2024

Not convinced this would be a good idea. The current system works perfectly fine, a single additional O(1) query is basically irrelevant compared to the cost of a post view query. Cursors are not supposed to be long-lived, and an exact post being purged during pagination is very unlikely.

Changing this is a large jump in complexity that needs to be implemented and maintained, and the size of the cursor would be huge.

@dullbananas
Copy link
Collaborator Author

a single additional O(1) query is basically irrelevant compared to the cost of a post view query

Depends on the amount of network latency with the database, which is potentially significant in a horizontally scaled setup

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