Skip to content

Batch update of records during migration - #11371

Merged
SchrodingersGat merged 3 commits into
inventree:masterfrom
SchrodingersGat:migration-tweak
Feb 19, 2026
Merged

SchrodingersGat merged 3 commits into
inventree:masterfrom
SchrodingersGat:migration-tweak

Conversation

@SchrodingersGat

@SchrodingersGat SchrodingersGat commented Feb 18, 2026 •

Copy link
Copy Markdown
Member

Reduce issues with data migration for very large datasets:

  • Prefetch the queryset to significantly reduce database overhead
  • Batch the "bulk update" operation to reduce memory and CPU usage

Reduce issues with very large datasets
@SchrodingersGat SchrodingersGat added this to the 1.3.0 milestone Feb 18, 2026
@SchrodingersGat SchrodingersGat added backport Apply this label to a PR to enable auto-backport action migration Data or schema migrations full-run Always do a full QC CI run backport-to-1.2.x labels Feb 18, 2026
@netlify

netlify Bot commented Feb 18, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for inventree-web-pui-preview canceled.

Name Link
🔨 Latest commit 726b483
🔍 Latest deploy log https://app.netlify.com/projects/inventree-web-pui-preview/deploys/69962cb8e946f8000814cf2f

@codspeed

codspeed Bot commented Feb 18, 2026 •

Copy link
Copy Markdown

Merging this PR will improve performance by 25.5%

⚠️ Unknown Walltime execution environment detected

Using the Walltime instrument on standard Hosted Runners will lead to inconsistent data.

For the most accurate results, we recommend using CodSpeed Macro Runners: bare-metal machines fine-tuned for performance measurement consistency.

⚡ 17 improved benchmarks
✅ 27 untouched benchmarks

Performance Changes

Mode Benchmark BASE HEAD Efficiency
⚡ WallTime test_api_list_performance[/api/part/] 75.6 ms 67 ms +12.81%
⚡ WallTime test_api_options_performance[/api/order/po-line/] 156.8 ms 136.5 ms +14.85%
⚡ WallTime test_api_list_performance[/api/stock/] 163.4 ms 138.5 ms +17.96%
⚡ WallTime test_api_list_performance[/api/company/] 18.6 ms 17.3 ms +7.63%
⚡ WallTime test_api_list_performance[/api/stock/location/] 20.1 ms 18.5 ms +8.74%
⚡ WallTime test_api_list_performance[/api/build/item/] 321.6 ms 256.2 ms +25.5%
⚡ WallTime test_api_list_performance[/api/order/so/] 43.6 ms 39.9 ms +9.15%
⚡ WallTime test_api_list_performance[/api/user/roles/] 8.8 ms 8.3 ms +6.78%
⚡ WallTime test_search_performance[part] 59.6 ms 55.2 ms +8.09%
⚡ WallTime test_search_performance[stockitem] 107.1 ms 93.5 ms +14.53%
⚡ WallTime test_search_performance[salesordershipment] 20.2 ms 19 ms +6.02%
⚡ WallTime test_search_performance[all] 357.8 ms 326.9 ms +9.48%
⚡ WallTime test_api_options_performance[/api/build/line/] 392.2 ms 332.6 ms +17.94%
⚡ WallTime test_api_list_performance[/api/parameter/] 11.5 ms 10.6 ms +8.34%
⚡ WallTime test_api_options_performance[/api/order/so/shipment/] 51.3 ms 48.2 ms +6.49%
⚡ WallTime test_api_list_performance[/api/order/so/shipment/] 22.4 ms 19.1 ms +16.93%
⚡ WallTime test_api_options_performance[/api/build/item/] 324.5 ms 276.4 ms +17.38%

Comparing SchrodingersGat:migration-tweak (726b483) with master (951586a)1

Open in CodSpeed

Footnotes

  1. No successful run was found on master (f620630) during the generation of this report, so 951586a was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩

@codecov

codecov Bot commented Feb 18, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 60.00000% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.04%. Comparing base (f620630) to head (726b483).
⚠️ Report is 330 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #11371      +/-   ##
==========================================
- Coverage   88.05%   88.04%   -0.01%     
==========================================
  Files        1292     1292              
  Lines       58525    58533       +8     
  Branches     1943     1943              
==========================================
+ Hits        51533    51536       +3     
- Misses       6508     6513       +5     
  Partials      484      484              
Flag Coverage Δ
backend 89.25% <30.00%> (-0.02%) ⬇️
migrations 42.26% <60.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
Backend Apps 91.80% <60.00%> (-0.01%) ⬇️
Backend General 93.38% <ø> (ø)
Frontend 70.88% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@SchrodingersGat
SchrodingersGat merged commit a4a3990 into inventree:master Feb 19, 2026
55 of 58 checks passed
@SchrodingersGat
SchrodingersGat deleted the migration-tweak branch February 19, 2026 01:03
github-actions Bot pushed a commit that referenced this pull request Feb 19, 2026
* Batch update of records during migration

Reduce issues with very large datasets

* Add short-circuit logic

* Filter and prefetch

(cherry picked from commit a4a3990)
@github-actions

Copy link
Copy Markdown
Contributor

💚 All backports created successfully

Status Branch Result
✅ 1.2.x

Questions ?

Please refer to the Backport tool documentation and see the Github Action logs for details

SchrodingersGat added a commit that referenced this pull request Feb 19, 2026
* Batch update of records during migration

Reduce issues with very large datasets

* Add short-circuit logic

* Filter and prefetch

(cherry picked from commit a4a3990)

Co-authored-by: Oliver <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport Apply this label to a PR to enable auto-backport action full-run Always do a full QC CI run migration Data or schema migrations

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants