-
Notifications
You must be signed in to change notification settings - Fork 25
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
GPS : Amélioration des performances de la recherche de bénéficiaires #4475
Conversation
2ee8d06
to
fbc5f4b
Compare
Instead of generating a new column and searching it with `LIKE %term%` (icontains), search a user whose first name or last name is `LIKE term%` (startswith). Also, use a simpler join to exclude beneficiaries for which the user is an active member of their follow up group. Performances ============ Measuring using the SQL panel of DjDT, with the request: ```bash curl 'http://127.0.0.1:8000/autocomplete/gps_users?term=dupont&_type=query&q=dupont' 'Cookie: sessionid=SESSIONID' ``` master: 454 ms commit: 24 ms
fbc5f4b
to
92421e7
Compare
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.
👍 la suppression du distinct
pour passer au Exists
.
A voir si la modif sur la clause de recherche est également acceptable (mais je me demande si l'Exists n'est pas suffisant ?)
search_terms = search_string.split(" ") | ||
name_q = [] | ||
for term in search_terms: | ||
name_q.append(Q(first_name__unaccent__istartswith=term)) |
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.
On passe de icontains
à istartswith
... Ça n'est pas la même recherche.
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.
Je n’ai pas mentionné https://itou-inclusion.slack.com/archives/C067CP07KJR/p1721834260473969 dans la description. On a discuté de ce changement avec Louis-Jean avant que je ne le réalise.
Désolé pour la confusion.
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.
Merci !! 🎉
Effectivement, la recherche n'est pas la même avec les istartwith
.
🤔 Pourquoi ?
La recherche de bénéficiaire est une nouvelle entrée dans les vues avec le plus haut User Misery sur Sentry (2ème pire vue du système) avec un P50 à plus de 4 secondes, ce qui affecte la base de données et l’expérience sur le site.
Performances
En utilisant le panneau SQL de DjDT, avec la requête :
master: 454 ms
commit: 24 ms
cf https://itou-inclusion.slack.com/archives/C067CP07KJR/p1721834260473969