Skip to content

Commit 46dbdcf

Browse files
rbartzenralonsoh
authored andcommitted
Change to use selectin for RBACs in SubnetPool DB load strategy
To solve a performance issue when using network rbacs with thousands of entries in the subnets, networks, and networks rbacs tables, it's necessary to change the eager loader strategy to not create and process a "cartesian" product of thousands of unnecessary combinatios for the purpose of the relationship included between rbac rules and subnetpool database model. We don't need a many-to-many relationship here. So, we can use the selectin eager loading to make this relationship one-to-many and create the model with only the necessary steps, without exploding into a thousands of rows caused by the "left outer join" cascade. The "total" queries from this process would be divided into a series of smaller queries with much better performance, and the resulting huge select query will be resolved much faster without joined cascade, representing significant performance gains. Closes-bug: #2071374 Change-Id: I2e4fa0ffd2ad091ab6928bdf0d440b082c37def2 (cherry picked from commit 46edf25)
1 parent 0a7b9d3 commit 46dbdcf

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

neutron/db/models_v2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ class SubnetPool(standard_attr.HasStandardAttributes, model_base.BASEV2,
308308
lazy='subquery')
309309
rbac_entries = sa.orm.relationship(rbac_db_models.SubnetPoolRBAC,
310310
backref='subnetpools',
311-
lazy='joined',
311+
lazy='selectin',
312312
cascade='all, delete, delete-orphan')
313313
api_collections = [subnetpool_def.COLLECTION_NAME]
314314
collection_resource_map = {subnetpool_def.COLLECTION_NAME:

0 commit comments

Comments
 (0)