-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
fix-slow-family-endpoint-in-the-admin-service #285
fix-slow-family-endpoint-in-the-admin-service #285
Conversation
- Use raw sequel to query the db and execute that using sql alchemy db.execute - Add in some testing parameter to check the length the operations are taking, to be removed
…rupt all processes
- handle filters, pass in where conditions appropriately - order by last modified - will pass query params into the raw sql query itself to prevent against sql injection - family status is not a column in the db but a property on the model/orm, so we can't access it directly in the query - have tried to mimic it in the main query and filter
- move the query for slugs into the main query, via a left sided join - add in back limit results by max results, we know this will be passed as a query param or use the default that will be set - todo access teh published date and last updated date
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: Would you mind documenting in the PR description why and how this solution fixes the problem we had with the endpoint? Just so that I don't have to try to figure it out from the SQL :-P
- this was a gnarly bug to find and fix, thank god for our tests - with the initial inner joins when we would have null values for event ids or document ids the query would ignore those records when returning the results. - adding a left join means that we still get those values back, for instances where a family is created but does not yet have an allocated document or event - the readdto does not allow for nonetypes so have converted this to an empty array as expected.
Sure hopefully that has helped. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really nice investigative work - I wish we had some metrics to show the improvement in real time.
Might be worth getting current local metrics and compare them so we can see the improvement.
…an-intensive-query
Description
The search endpoint
api/v1/families/?q=
for families was running quite slow in the admin service, taking over 6 seconds to return a response. Notably on the cclw user admin account which has the most amount of documents and families, we suspected that this had something to do with the multiple geographies changes that we made.To resolve this we have gone with using a raw sql query and instead executing that.
These are represented in the sql query as such
Proposed version
Please select the option below that is most relevant from the list below. This
will be used to generate the next tag version name during auto-tagging.
Visit the Semver website to understand the
difference between
MAJOR
,MINOR
, andPATCH
versions.Notes:
used -- e.g. Major > Minor > Patch
sure your selected option is marked
[x]
with no spaces in between thebrackets and the
x
Type of change
Please select the option(s) below that are most relevant:
How Has This Been Tested?
Please describe the tests that you added to verify your changes.
Reviewer Checklist