[RBAC] Optimize compute_object_role_permissions
as iterable with prefetch_related
#300
Labels
app:rbac
performance
Reduction of queries, query performance, etc.
ready to work
Item is ready to be worked on
If you use Django debug toolbar, you can run the following to see how performant DAB RBAC is for rebuilding the entire RoleEvaluation table
You find that it is limited by a particular constraint, which is that we need to some simple-looking prefetches added:
However, this loses
.iterator()
which is probably unacceptable, because this is the one big memory-intensive table involved in querysets.There is a very good proposed solution at https://djangosnippets.org/snippets/1949/ but it is not a standard Django util.
This will give 1 order-of-magnitude improvement in the above scenario.
The ToS on the site provides license for the code snippets: https://djangosnippets.org/about/tos/
The text was updated successfully, but these errors were encountered: