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

Added index on aggregator_feeditem (date_modified DESC) #1517

Merged
merged 1 commit into from
Apr 10, 2024

Conversation

tobiasmcnulty
Copy link
Member

@tobiasmcnulty tobiasmcnulty commented Apr 10, 2024

For pages early in the aggregator/community feeds, there is a tremendous speedup when an index is added on aggregator_feeditem (date_modified DESC) (i.e., in the order in which the FeedItems are returned). In my tests, it reduced the query time from ~170ms to ~6ms. The change will help reduce load on the database server and free up uWSGI processes for other requests.

Copy link
Member

@bmispelon bmispelon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great, especially if the speedups you observed locally hold up in production also.

One nitpick I had would be to change the name of the migration file to something slightly more readable. Maybe 0005_feeditem_add_index_date_modified.py. What do you think?

@tobiasmcnulty
Copy link
Member Author

Thanks for the review!

One nitpick I had would be to change the name of the migration file to something slightly more readable. Maybe 0005_feeditem_add_index_date_modified.py. What do you think?

That is a favorite nitpick of mine, I am surprised I let it slip, lol. Updated!

@tobiasmcnulty tobiasmcnulty merged commit 5a28ba1 into main Apr 10, 2024
2 checks passed
@tobiasmcnulty tobiasmcnulty deleted the aggregator_index branch April 10, 2024 13:41
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.

None yet

2 participants