Mass-creation of tree-based models with MPTT (Region, TenantGroup, InventoryItem, RackGroup, ...?) #3433
Kircheneer
started this conversation in
Show and tell
Replies: 1 comment
-
Thank you for sharing this @Kircheneer! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Despite MPTT being migrated away from in 2.0 I wanted to briefly shared a workaround I had to use for performance issues when mass-creating regions (the same probably applies to the other MPTT-based models, although I didn't test it):
This significantly speeds up region creation (from ~0.5s per region to ~0.02s per region) when creating a lot of them at once by disabling the tree updates and doing them in bulk when all region objects (whose tree relationships are broken prior to the rebuilding) are in place.
Beta Was this translation helpful? Give feedback.
All reactions