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

OpenConceptLab/ocl_issues#878 | Locale type standardization #15

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

snyaggarwal
Copy link
Contributor

No description provided.

for start in range(0, total, batch_size):
end = min(start + batch_size, total)
locales = LocalizeText.objects.filter(
id__in=queryset.order_by('id')[start:end].only('id').values_list('id', flat=True))
Copy link
Contributor

@rkorytkowski rkorytkowski Aug 10, 2021

Choose a reason for hiding this comment

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

I feel this will not perform well... start:end is a slow one for millions of records to update as it uses OFFSET. Also if you use 'values_list' you don't need 'only'. We should be able to change it to an update without a subquery like:
update localized_texts set type='FULLY_SPECIFIED' where type in ('Fullly Specified', 'Fully_Specified', ...)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ya, I can change that to run direct SQL:
update localized_texts set type='FULLY_SPECIFIED' where type in ('Fullly Specified', 'Fully_Specified', ...)

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.

2 participants