Duplicate indexes in table ports of neutron database
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
neutron |
In Progress
|
Undecided
|
Unassigned |
Bug Description
Currently the primary key and an additional unique index are configured on the same column.
This is why sqlalchemy logs a warning on a database migration displaying following information:
```
/usr/lib/
result = self._query(query)
```
(This example is actually taken from the nova output, but looks just the same for Keystone.
There actually is the same issue within Nova schemas, see bug https:/
From my understanding of the documentation of mysql (see [1] [2]) and postgres (see [3] [4]) a unique constraint, which is created in the first place, automatically creates an index for the column(s). So there should be no need to create an additional index for the same column:
```
Table: ports (https:/
Columns: network_id, mac_address
Indexes:
Unique Constraint: uniq_ports0netw
Index: ix_ports_
```
[1] https:/
[2] https:/
[3] https:/
[4] https:/
Changed in neutron: | |
status: | Expired → New |
status: | New → Incomplete |
Changed in neutron: | |
status: | Incomplete → Expired |
Changed in neutron: | |
status: | Expired → In Progress |
status: | In Progress → New |
status: | New → Incomplete |
These two items were added to the DB code for different reasons - one for correctness (constraint), the other for performance (index). They were done some time ago (8 years, Kilo-ish cycle) so I'm a little weary at changing things without having someone take a closer look.
Do you have a log of the Warning being emitted for this table? I didn't see anything in a new devstack install.