:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
perf(skills): index skill versions by team and name (#93012)
posthog[bot]b99b0225b0f4
diff --git a/products/skills/backend/migrations/0007_llmskill_team_name_version_idx.py b/products/skills/backend/migrations/0007_llmskill_team_name_version_idx.pynew file mode 100644index 000000000000..5c28ebad7387--- /dev/null+++ b/products/skills/backend/migrations/0007_llmskill_team_name_version_idx.py@@ -0,0 +1,18 @@+from django.db import migrations, models++from posthog.migration_helpers import SafeAddIndexConcurrently+++class Migration(migrations.Migration):+ atomic = False++ dependencies = [+ ("skills", "0006_llmskill_version_description"),+ ]++ operations = [+ SafeAddIndexConcurrently(+ model_name="llmskill",+ index=models.Index(fields=["team", "name", "-version"], name="llm_skill_team_name_ver_idx"),+ ),+ ]diff --git a/products/skills/backend/migrations/max_migration.txt b/products/skills/backend/migrations/max_migration.txtindex 6f8be68db3e8..db774a9c187f 100644--- a/products/skills/backend/migrations/max_migration.txt+++ b/products/skills/backend/migrations/max_migration.txt@@ -1 +1 @@-0006_llmskill_version_description+0007_llmskill_team_name_version_idxdiff --git a/products/skills/backend/models/skills.py b/products/skills/backend/models/skills.pyindex f5e7d94c498d..ecf1fffe1d95 100644--- a/products/skills/backend/models/skills.py+++ b/products/skills/backend/models/skills.py@@ -36,6 +36,12 @@ class LLMSkill(UUIDModel):name="unique_llm_skill_latest_per_team",),]+ indexes = [+ # The lazy-seed reconcilers read every version of one skill, tombstones included, so+ # they pass no `deleted` predicate and the partial unique constraints above cannot+ # serve them. Without this, Postgres scans the team's whole skill history per lookup.+ models.Index(fields=["team", "name", "-version"], name="llm_skill_team_name_ver_idx"),+ ]# Required by Agent Skills spec (https://agentskills.io/specification)name = models.CharField(max_length=64)