From 7218e69b1d2ba1a1fc6bb4f15719f2b1e41b7039 Mon Sep 17 00:00:00 2001 From: jknapp Date: Fri, 15 May 2026 08:08:22 -0700 Subject: [PATCH] fix(migration): drop invalid trigram index on tags[] column gin_trgm_ops only applies to text, not text[]. The plain GIN index on tags is sufficient for the `@>` / `<@` / `&&` set-containment operators used by memory.list. pg_trgm stays loaded for future fuzzy search over content. Co-Authored-By: Claude Opus 4.7 (1M context) --- apps/web/drizzle/0000_init.sql | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/web/drizzle/0000_init.sql b/apps/web/drizzle/0000_init.sql index b0eb4f5..b2bfb10 100644 --- a/apps/web/drizzle/0000_init.sql +++ b/apps/web/drizzle/0000_init.sql @@ -84,9 +84,9 @@ CREATE INDEX "memories_created_idx" ON "memories" ("created_at" DESC); -- GIN index for full-text search over the generated tsvector column. CREATE INDEX "memories_content_tsv_idx" ON "memories" USING GIN ("content_tsv"); --- GIN index on tags for exact-tag filtering, and trigram index for fuzzy matching. -CREATE INDEX "memories_tags_idx" ON "memories" USING GIN ("tags"); -CREATE INDEX "memories_tags_trgm_idx" ON "memories" USING GIN ("tags" gin_trgm_ops); +-- GIN index on tags for tag-set containment queries (`tags @> ARRAY[...]`). +-- pg_trgm is loaded for future fuzzy text search on `content`, not tags. +CREATE INDEX "memories_tags_idx" ON "memories" USING GIN ("tags"); -- IVFFlat vector index. Lists=100 is a reasonable starting point; tune later -- once we have real volume. Note: the index requires data to be useful — it's