Skip to content

Optimize question migration#2722

Open
Kakadus wants to merge 1 commit into
e-valuation:mainfrom
Kakadus:optimize-question-migration
Open

Optimize question migration#2722
Kakadus wants to merge 1 commit into
e-valuation:mainfrom
Kakadus:optimize-question-migration

Conversation

@Kakadus

@Kakadus Kakadus commented May 8, 2026

Copy link
Copy Markdown
Collaborator

redesign evaluation 0161 and 0162 migration so that all question objects are not stored in python.

  • use bulk_create with batch_size 2000 on plain querysets only
  • update answer objects with single update + subqueries for joined fields

followup for #2513

.distinct("text_de", "text_en", "allows_additional_textanswers", "type")
.iterator()
),
batch_size=2000,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Let's not do hasty changes to code for issues we don't fully understand. @janno42 do we have a specific understanding what part of this migration is problematic?

I would like to first have some test data for which we can reproduce the issue, and then properly check that a change here actually solves the issue. My mental model is that we have hundreds of questionnaires and maybe ten thousands of questions in production. This should be in the range of megabytes of data. We should easily be able to load those model instances, especially if no related models are ever loaded/accessed.

I could see that we have more answers than fit in memory, then we should do a targeted fix for that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants