SQL query explosion for bgpvpn
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
networking-bgpvpn |
Fix Released
|
High
|
Pierre Crégut |
Bug Description
When networking-bgpbpn fetches a bgpvpn object from the database through sqlalchemy, it will use the relations with networks and routers eagerly. This means it will build a query whose skeleton is:
SELECT <columns (240) FROM bgpvpns
LEFT OUTER JOIN bgpvpn_
...
LEFT OUTER JOIN bgpvpn_
LEFT OUTER JOIN routers ON routers1.id = bgpvpn_
...
There are two problems:
- A huge query fetching 240 columns at once and performing 45 outer joins
- An explosion of the number of rows returned: if there are i networks and j routers, there will be i*j rows leading to a potential combinatorial explosion in the size of the result.
The problem is exacerbated by the fact that a single network or routers can be represented by several rows for the same reason (if it has several tags, subnets, rbac rules, prefix in subnetpools, explicit routes etc. )
The solution is to use lazy="select" for the relations between bgpvpn and bgpvpn_
Changed in bgpvpn: | |
assignee: | nobody → Pierre Crégut (pcregut) |
Changed in bgpvpn: | |
status: | New → Confirmed |
importance: | Undecided → High |
milestone: | none → 6.0.0 |
Fix proposed to branch: master /review. openstack. org/386608
Review: https:/