From: Ann Kamyshnikova Date: Fri, 27 Feb 2015 14:06:43 +0000 (+0300) Subject: Make listing security groups faster X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=5917fcff32a51e755b7bb90790cac5afd92556e8;p=openstack-build%2Fneutron-build.git Make listing security groups faster If we have a large number of security groups (more than 1000) with security group rules (about 100 for each group) listing them could take rather long time(more than 1 minute). Adding lazy join to backref to SecurityGroupRule model will make it faster at list on 15%. Change-Id: I648a48cdefe0faf75c0c62bd8adffc12547293be Closes-bug: #1426383 --- diff --git a/neutron/db/securitygroups_db.py b/neutron/db/securitygroups_db.py index ec3f548e4..658f27514 100644 --- a/neutron/db/securitygroups_db.py +++ b/neutron/db/securitygroups_db.py @@ -100,7 +100,7 @@ class SecurityGroupRule(model_base.BASEV2, models_v2.HasId, remote_ip_prefix = sa.Column(sa.String(255)) security_group = orm.relationship( SecurityGroup, - backref=orm.backref('rules', cascade='all,delete'), + backref=orm.backref('rules', cascade='all,delete', lazy='joined'), primaryjoin="SecurityGroup.id==SecurityGroupRule.security_group_id") source_group = orm.relationship( SecurityGroup,