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

perf(getIsCommentDoublePost): optimize extremely slow query #3153

Merged

Conversation

wescopeland
Copy link
Member

Adds an index to optimize the query called in getIsCommentDoublePost().

I'm not sure what has changed, but this query:

$lastComment = Comment::where('user_id', $userID)
    ->orderBy('Submitted', 'desc')
    ->first();

is now taking multiple seconds to run. A simple compound index resolves the issue.

This is the root cause of achievement uploads taking a noticeably long period of time from the toolkit.

@wescopeland wescopeland requested a review from a team January 30, 2025 01:02
@wescopeland wescopeland merged commit d242daf into RetroAchievements:master Jan 31, 2025
9 checks passed
@wescopeland wescopeland deleted the slow-comments-query-fix branch January 31, 2025 22:56
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

Successfully merging this pull request may close these issues.

2 participants