mirror of
https://github.com/ansible/awx.git
synced 2026-08-04 20:10:01 -02:30
AAP-81517 — Optimize HostList API: conditional DISTINCT + composite index Make .distinct() conditional on host_filter being set — without it the RBAC IN subquery on a direct FK cannot produce duplicates, so DISTINCT is pure overhead. Add composite index (host_id, id DESC) on main_jobhostsummary so the with_latest_summary_id() correlated subquery can use an index-only top-1 scan instead of scanning and sorting. Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
18 lines
432 B
Python
18 lines
432 B
Python
from django.db import migrations, models
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
dependencies = [
|
|
('main', '0205_add_ordering_to_instancegroup_and_workflow_nodes'),
|
|
]
|
|
|
|
operations = [
|
|
migrations.AddIndex(
|
|
model_name='jobhostsummary',
|
|
index=models.Index(
|
|
fields=['host', '-id'],
|
|
name='main_jobhostsumm_host_id_desc',
|
|
),
|
|
),
|
|
]
|