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

(PC-31961)[API] feat: Delete offers description when linked to a product #14249

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mageoffray
Copy link
Contributor

@mageoffray mageoffray commented Sep 20, 2024

But de la pull request

Ticket Jira (ou description si BSR) : https://passculture.atlassian.net/browse/PC-31961

Delete description from offers when linked to a product.
We have 255_000_000 offers in our database, only 2_000_000 are not linked to a product. Save the pandas and pinguins by drastically reducing the space used by our offer table (not really, but one day).
According to metabase this column takes 157 Gb (not sure about that)
Screenshot 2024-09-20 at 10 37 25

I'll add timing metrics once it will be tested on staging

Vérifications

  • J'ai écrit les tests nécessaires
  • J'ai mis à jour le fichier des plans de tests du portail pro si nécessaire
  • J'ai mis à jour la liste des routes et des titres de pages du portail pro si j'en ai rajouté/modifié ou supprimé une.
  • J'ai relu attentivement les migrations, en particulier pour éviter les locks, et je préviens les équipes Shérif et Data
  • J'ai ajouté des screenshots pour d'éventuels changements graphiques

@mageoffray mageoffray force-pushed the mageoffray/pc-31961-script-delete-description branch from c9ee6b0 to d30b0ed Compare September 20, 2024 09:39
@mageoffray mageoffray force-pushed the mageoffray/pc-31961-script-delete-description branch from d30b0ed to 02bd040 Compare September 20, 2024 09:58
)
if not_dry:
db.session.commit()
if i % vacuum_treshold_rounded == 0:
Copy link
Contributor

Choose a reason for hiding this comment

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

Prenons le cas ou le k*batch size+ starting_id ne tombe jamais sur un mutliple de vacccum_treshold(qui est fixe) avec un interval très important entre start et end et un un start> vacumm_treshold. on ne va pas faire de vaccum même si on traite un vaccum_treshold nombre de lignes.

Copy link
Contributor Author

@mageoffray mageoffray Sep 20, 2024

Choose a reason for hiding this comment

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

Yes en effet, je m'étais dis ça et j'ai ajouté un arrondi pour tomber toujours sur un multiple de 1000.
Mais au final comme j'ai fais un lot qui commence à 1, i vaudra toujours 1, 1001, 2001, ... Et sera jamais un multiple de vacuum_treshold_rounded.
Faut que j'améliore le truc, merci 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants