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 prepared queries for scheduled tasks #5372

Open
Nutomic opened this issue Jan 31, 2025 · 1 comment
Open

Using prepared queries for scheduled tasks #5372

Nutomic opened this issue Jan 31, 2025 · 1 comment
Labels
area: database enhancement New feature or request

Comments

@Nutomic
Copy link
Member

Nutomic commented Jan 31, 2025

Based on this discussion, diesel doesnt use prepared query cache for raw sql queries which we use for some of the scheduled tasks. This can result in much slower queries. So it may be worth manually implementign QueryFragment for those, or better yet getting a function prepared_sql() merged upstream. Or maybe the queries can be rewritten without raw sql.

@Nutomic Nutomic added area: database enhancement New feature or request labels Jan 31, 2025
@dessalines
Copy link
Member

For reference, here's the WITH query we should try to convert to pure diesel: https://github.com/LemmyNet/lemmy/blob/main/crates/routes/src/utils/scheduled_tasks.rs#L217

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: database enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants