Slow listings with many projects and deleted resources
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Cinder |
Fix Released
|
Low
|
Gorka Eguileor |
Bug Description
Cinder's resource tables (volumes, snapshots, backups, groups) don't have required indexes to do efficient resource listings on the database engine.
This forces the database to go through all existing database records for any listing (even when there are no additional user requested filtering) and check one by one the conditions.
As an example a simple listing for a project with a single volume:
[vagrant@localhost devstack]$ cinder list
+------
| ID | Status | Name | Size | Volume Type | Bootable | Attached to |
+------
| 8a6b11d5-
+------
May result in the database going through thousand of records (all deleted records and all records for other projects) as demonstrated by the following SQL queries where 10435 rows were checks to return a single on:
[vagrant@localhost ~]$ mysql cinder -e 'select id, display_name from volumes where not deleted and project_
+------
| id | display_name |
+------
| 8a6b11d5-
+------
[vagrant@localhost ~]$ mysql cinder -e 'explain select id, display_name from volumes where not deleted and project_
+------
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+------
| 1 | SIMPLE | volumes | ALL | NULL | NULL | NULL | NULL | 10435 | Using where |
+------
Changed in cinder: | |
importance: | Undecided → Low |
tags: | added: listing |
Fix proposed to branch: master /review. opendev. org/c/openstack /cinder/ +/819669
Review: https:/