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

fix: reduce the number of queries in the dashboard by eager loading the contacts #2138

Merged
merged 8 commits into from
Dec 18, 2018
Merged

fix: reduce the number of queries in the dashboard by eager loading the contacts #2138

merged 8 commits into from
Dec 18, 2018

Conversation

AdrienPoupa
Copy link

@AdrienPoupa AdrienPoupa commented Dec 6, 2018

The following pull request eager loads the contacts for the reminders in the dashboard, in getRemindersForMonth

Since contacts are accessed several times from the _monthReminder view, load them from the beginning.

On my installation, adding the with line does the following:

Before After
179 queries 111 queries
7.8Mb 7.2Mb
185ms 140ms

As a bonus, if I had not any partial contact, the number of queries would drop to 27, 84ms and 6.60Mb

@ahilles107
Copy link

👍

@djaiss
Copy link
Member

djaiss commented Dec 8, 2018

That is awesome ❤️

I love those optimizations.

Copy link
Member

@asbiin asbiin left a comment

Choose a reason for hiding this comment

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

Nice work! Thank you @AdrienPoupa !

@AdrienPoupa
Copy link
Author

You're welcome! However, before merging, be aware that I added a new commit that reduces the number of queries even more for partial contacts (41 queries now on the same installation, 120ms)

@asbiin asbiin merged commit a1c9361 into monicahq:master Dec 18, 2018
@asbiin
Copy link
Member

asbiin commented Dec 18, 2018

Thank you very much @AdrienPoupa !

@github-actions
Copy link

This pull request has been automatically locked since there
has not been any recent activity after it was closed.
Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 28, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants