distcloud/distributedcloud/dcmanager/db
Gustavo Herzmann a07300567e Add indexes to optimize subcloud queries
Add indexes to dcmanager database to improve query performance:
- subcloud_status_subcloud_id_idx on subcloud_status(subcloud_id)
- subclouds_region_name_idx on subclouds(region_name)

These indexes were added to optimize queries that:
1. Select subcloud status by subcloud_id
2. Filter subclouds by region_name

Previously these queries were performing sequential table scans,
resulting in slow query execution times. The new indexes will
enable index scans for these common query patterns, improving
performance.

Test Plan:
01. PASS - Run "sudo dcmanager-manage db_sync" and verify that both
    indexes were created successfully.
02. PASS - Verify query performance improvement by running EXPLAIN
    ANALYZE on the queries that were previously slow. Confirm that
    index scans are now being used instead of sequential scans and
    verify that the execution times have been reduced.
03. PASS - Run subcloud audit and manage on a scale environment and
    verify that the overall execution time has been reduced and that
    there are no slow query logs in postgresql.

Story: 2011106
Task: 51245

Change-Id: If50d2719ce571e1a5f3c774ed8ecf2874a51ab18
Signed-off-by: Gustavo Herzmann <gustavo.herzmann@windriver.com>
2024-11-01 17:50:22 -03:00
..
sqlalchemy Add indexes to optimize subcloud queries 2024-11-01 17:50:22 -03:00
__init__.py Move content to subdir to support relocated packaging 2019-11-04 13:57:02 -05:00
api.py Remove force parameter for sw-deploy, rootca, kubernetes strategies 2024-10-07 12:32:26 +00:00
utils.py Apply black formatter to dcmanager/db 2024-07-29 21:20:59 -03:00