yggdrasil/migrations/014_drop_ineffective_trgm_index.sql
xfy b34803e57d fix(search): drop ineffective trgm GIN index; correct misleading comment
ILIKE '%...%' 双侧通配符无法命中 trgm GIN(仅前缀模式命中),索引建了等于
白建且误导(L1)。删除以避免误导,搜索暂靠 LIMIT + 限流兜底;tsvector 全文
检索作为后续独立升级。
2026-06-18 13:42:23 +08:00

6 lines
391 B
SQL
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

-- 删除对 ILIKE '%...%'(双侧通配符)无效的 trgm GIN 索引L1
-- pg_trgm 的 GIN 索引只在前缀模式('xxx%')命中,双侧模糊匹配无法利用它,
-- 索引建了等于白建且误导。搜索改由 LIMIT + 限流兜底的全表扫承担;
-- 后续可升级为 tsvector 全文检索(独立大改动)。
DROP INDEX IF EXISTS idx_posts_search_trgm;