Skip to content

Commit 6aa0712

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. The index also includes the submission date sorted descending, as this is the default sorting key for the patches list.
1 parent c9e4d3d commit 6aa0712

2 files changed

Lines changed: 39 additions & 0 deletions

File tree

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
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+
dependencies = [
9+
('patchwork', '0048_series_dependencies'),
10+
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
11+
]
12+
13+
operations = [
14+
migrations.AddIndex(
15+
model_name='patch',
16+
index=models.Index(
17+
fields=[
18+
'project',
19+
'archived',
20+
'state',
21+
'-date',
22+
'delegate',
23+
'submitter',
24+
],
25+
name='patch_covering_idx_default',
26+
),
27+
),
28+
]

‎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)