From 85d3fff97e55ba85f72cda4365ad0441c10bd9f6 Mon Sep 17 00:00:00 2001 From: Slawek Kaplonski Date: Wed, 16 Aug 2023 12:14:19 +0200 Subject: [PATCH] Use HasStandardAttributes as parent class for Tags DB model Tags db model class had defined standard attribute relationship as "subquery" which leads to massive number of SELECT sql queries to get those standard attributes for any tag. With this patch this db model will use relationship definition from the HasStandardAttributes class which is the same for all models with standard attributes and which is "joined" model. Change-Id: If11288c89c362c8d6f97833d89b3df77e51ee363 --- neutron/db/models/tag.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/neutron/db/models/tag.py b/neutron/db/models/tag.py index 55195340d03..14e680fccc7 100644 --- a/neutron/db/models/tag.py +++ b/neutron/db/models/tag.py @@ -26,6 +26,6 @@ class Tag(model_base.BASEV2): tag = sa.Column(sa.String(255), nullable=False, primary_key=True) standard_attr = orm.relationship( 'StandardAttribute', load_on_pending=True, - backref=orm.backref('tags', lazy='subquery', viewonly=True), + backref=orm.backref('tags', lazy='joined', viewonly=True), sync_backref=False) revises_on_change = ('standard_attr', )