Skip to content

Add Indices to Foreign Key Columns in SubscribedSubredditData, SubscribedUserData and MultiReddit#1687

Merged
Docile-Alligator merged 6 commits intoDocile-Alligator:masterfrom
adripo:missing-indexes
Mar 16, 2025
Merged

Add Indices to Foreign Key Columns in SubscribedSubredditData, SubscribedUserData and MultiReddit#1687
Docile-Alligator merged 6 commits intoDocile-Alligator:masterfrom
adripo:missing-indexes

Conversation

@adripo
Copy link
Contributor

@adripo adripo commented Jul 24, 2024

Description:

Problem:

In the current implementation, the username column in the SubscribedSubredditData, SubscribedUserData, and MultiReddit tables references a foreign key but is not indexed. This may trigger full table scans whenever the parent table is modified, leading to performance issues.
Details: https://github.com/Docile-Alligator/Infinity-For-Reddit/actions/runs/10067294236/job/27830465944#step:4:109

Solution:

To resolve this, indices have been added to the username columns in the database tables. Additionally, the database schema version has been incremented and migration strategies have been provided to handle the creation of these indices.

Testing:

  • Verified that the indices are created successfully during migration.
  • Ensured that the application runs without performance warnings.

Checklist:

  • Added @Index annotation to username columns.
  • Incremented the database version.
  • Provided migration strategies.
  • Verified successful migration and absence of performance warnings.

Please review and merge the changes.

@iDaoU
Copy link

iDaoU commented Feb 11, 2025

@Docile-Alligator is there any reason we don't want to merge this?

@Docile-Alligator
Copy link
Owner

@iDaoU oh right. Sorry I forgot. Will merge it soon.

@Docile-Alligator Docile-Alligator merged commit 4d08e30 into Docile-Alligator:master Mar 16, 2025
2 checks passed
@Docile-Alligator
Copy link
Owner

Thank you!

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.

3 participants