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 46edf255bde0603fe88b2dd9f4e482590e384382)
This commit is contained in:
parent
c6d4a3e364
commit
4c70d3ea61
@ -302,7 +302,7 @@ class SubnetPool(standard_attr.HasStandardAttributes, model_base.BASEV2,
|
||||
lazy='subquery')
|
||||
rbac_entries = sa.orm.relationship(rbac_db_models.SubnetPoolRBAC,
|
||||
backref='subnetpools',
|
||||
lazy='joined',
|
||||
lazy='selectin',
|
||||
cascade='all, delete, delete-orphan')
|
||||
api_collections = [subnetpool_def.COLLECTION_NAME]
|
||||
collection_resource_map = {subnetpool_def.COLLECTION_NAME:
|
||||
|
Loading…
x
Reference in New Issue
Block a user