Skip to content

Commit ced0566

Browse files
committed
views: Add a new covering index for patch table
The new index uses project_id as the first key. This is important, as it seems that almost all web queries filter over project_id. This index indexes over descending submission date, as this is the default sorting for the patches list.
1 parent 0024f29 commit ced0566

2 files changed

Lines changed: 30 additions & 0 deletions

File tree

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Generated by Django 6.0.6 on 2026-08-13 00:14
2+
3+
from django.conf import settings
4+
from django.db import migrations, models
5+
6+
7+
class Migration(migrations.Migration):
8+
9+
dependencies = [
10+
('patchwork', '0048_series_dependencies'),
11+
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
12+
]
13+
14+
operations = [
15+
migrations.AddIndex(
16+
model_name='patch',
17+
index=models.Index(fields=['project', 'archived', 'state', '-date', 'delegate', 'submitter'], name='patch_covering_idx_default'),
18+
),
19+
]

patchwork/models.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -735,6 +735,17 @@ class Meta:
735735
],
736736
name='patch_covering_idx',
737737
),
738+
models.Index(
739+
fields=[
740+
'project',
741+
'archived',
742+
'state',
743+
'-date',
744+
'delegate',
745+
'submitter',
746+
],
747+
name='patch_covering_idx_default',
748+
),
738749
]
739750

740751

0 commit comments

Comments
 (0)