Skip to content

Commit ab26608

Browse files
authored
perf(api): add trigram indexes for finding groups (#10378)
1 parent 4638b39 commit ab26608

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Generated by Django 5.1.15 on 2026-03-18
2+
3+
from django.contrib.postgres.indexes import GinIndex, OpClass
4+
from django.contrib.postgres.operations import AddIndexConcurrently
5+
from django.db import migrations
6+
from django.db.models.functions import Upper
7+
8+
9+
class Migration(migrations.Migration):
10+
atomic = False
11+
12+
dependencies = [
13+
("api", "0084_googleworkspace_provider"),
14+
]
15+
16+
operations = [
17+
AddIndexConcurrently(
18+
model_name="findinggroupdailysummary",
19+
index=GinIndex(
20+
OpClass(Upper("check_id"), name="gin_trgm_ops"),
21+
name="fgds_check_id_trgm_idx",
22+
),
23+
),
24+
AddIndexConcurrently(
25+
model_name="findinggroupdailysummary",
26+
index=GinIndex(
27+
OpClass(Upper("check_title"), name="gin_trgm_ops"),
28+
name="fgds_check_title_trgm_idx",
29+
),
30+
),
31+
]

api/src/backend/api/models.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1783,6 +1783,15 @@ class Meta(RowLevelSecurityProtectedModel.Meta):
17831783
fields=["tenant_id", "provider", "inserted_at"],
17841784
name="fgds_tenant_prov_ins_idx",
17851785
),
1786+
# Trigram indexes for case-insensitive search
1787+
GinIndex(
1788+
OpClass(Upper("check_id"), name="gin_trgm_ops"),
1789+
name="fgds_check_id_trgm_idx",
1790+
),
1791+
GinIndex(
1792+
OpClass(Upper("check_title"), name="gin_trgm_ops"),
1793+
name="fgds_check_title_trgm_idx",
1794+
),
17861795
]
17871796

17881797
class JSONAPIMeta:

0 commit comments

Comments
 (0)