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

Feature/302 #311

Merged
merged 6 commits into from
Oct 11, 2024
Merged

Feature/302 #311

merged 6 commits into from
Oct 11, 2024

Conversation

afonsobspinto
Copy link
Member

@afonsobspinto afonsobspinto commented Oct 7, 2024

Closes https://metacell.atlassian.net/browse/SCKAN-302

  • Eliminated N+1 query problem by using select_related and prefetch_related to fetch related objects in bulk before iterating over them.

  • Prefetched related data with filters by utilized Prefetch objects with filtered querysets for notes and tags.

  • Avoided conditional database calls in loops by replacing exists() checks followed by all() calls with a single fetch and a simple list check.

Exporting again the 140 statements that existed in the database @ddelpiano shared with me was tacking longer than 10 minutes before the changes. After it took 80.70 seconds:
2024-10-07 201242,420 - logs composer export.txt
I didn't individually check the export, but overall the content looks correct
2024-10-07 201242,420 - logs composer export.txt

Misc:

  • Adds loading spinner to the export button in the admin page

@ddelpiano
Copy link
Member

500 is a number of statements that should be realistic for the export, note for @SimaoBolota-MetaCell for testing this.

Copy link
Member

@ddelpiano ddelpiano left a comment

Choose a reason for hiding this comment

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

lgtm

@ddelpiano ddelpiano merged commit 39aa747 into develop Oct 11, 2024
1 check passed
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