-
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
Admin : ajout d'un filtre et affichage du updated_at
pour GPS
#4310
Conversation
0697699
to
7d4a544
Compare
🥁 La recette jetable est prête ! 👉 Je veux tester cette PR ! |
3be73e6
to
75d2bd0
Compare
|
||
|
||
def _update_follow_up_groups_created_in_bulk(apps, schema_editor): | ||
FollowUpGroup = apps.get_model("gps", "FollowUpGroup") |
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.
Attention, j'ai peut que la migration dire trop longtemps vu le nombre d'objets à vérifier.
à chaque appel à groups[:10000]
django va refaire une requête SQL et donc parcourir les objets un par un pour regarder si la date fonctionne.
Il est possible que ce soit rapide vu que presque tous sont dans ce cas là, mais je n'exclue pas que ça puisse être méga long (j'ai eu le soucis pour remplir les JobApplication.processed_at
cette semaine)
Je vois 3 possibilités :
- lancer le remplissage depuis une fastmachine avant de déployer la migration gps.0003
- ajouter un index sur created_at à la main via psql avant (et le retirer après)
- ajouter un index sur created_at via django avant (et le retirer après)
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.
Bonne idée ! J'ai ajouté un index sur created_at
. Peux-tu tester en local ?
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.
c'est top : 1 minute 30 secondes en local
sans l'index ça prend plutôt 2 minutes donc le gain semble en effet faible, mais au moins on est tranquille au cas où la bdd a du mal (comme ça été le cas pour la création des groupes)
75d2bd0
to
7c02b70
Compare
dbb35b1
to
46652d4
Compare
46652d4
to
411cb06
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.
Un nom de migration plus clair peut-être ?
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.
Fait !
411cb06
to
a0bc470
Compare
a0bc470
to
7848153
Compare
7848153
to
75e908b
Compare
🤔 Pourquoi ?
Pour mieux mesurer notre impact.
🚨 À vérifier
🏝️ Comment tester
Aller dans l'admin de Django puis dans Relation ou Groupe de suivi.
💻 Captures d'écran