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

Improve queries to read announcements #108

Merged

Conversation

rafa-acioly
Copy link
Contributor

This change improve the number of queries regarding the reading of announcements.

Before

  1. Retrieve all announcements (may be slow when the table is big)
  2. Check if the user doesn't already have the announcement (call N times the announcement table)
  3. Attach each missing announcement to the user (call N times the announcement table)

Now

  1. Retrieve all announcements that the user doesn't have (1 query)
  2. Attach all announcements to the user (1 query)

@rafa-acioly
Copy link
Contributor Author

Can we merge this PR @bobbyiliev ?

Copy link
Collaborator

@bobbyiliev bobbyiliev left a comment

Choose a reason for hiding this comment

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

Thank you for the improvement! Just tested this out and it looks good!

@bobbyiliev bobbyiliev merged commit e0cbdc4 into thedevdojo:main Nov 15, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants