gendesign/data/sql/116_obj2_multi_feature_matcher.sql
lekss361 f9b8468bfc fix(obj-2): trim migration 116 to GIST trgm index only — INSERT CTE timed out in deploy
Original CTE (CROSS JOIN LATERAL similarity на 1056 × 320 unmapped × top-3)
завис на deploy таймауте (89M cost узнан через EXPLAIN database-expert worker).

GIST trgm index — load-bearing для downstream queries, оставлен.

Multi-feature INSERT (composite >= 0.75) уже частично применён inline
2026-05-17 (+13 мапingов: 129 → 142). Полный backfill будет в отдельной
миграции 117 с pre-materialized temp tables для avoidance of full LATERAL
scan.
2026-05-17 23:17:59 +03:00

15 lines
804 B
SQL

-- 116_obj2_multi_feature_matcher.sql (HOTFIX — INSERT step deferred)
-- Issue #307 OBJ-2.
--
-- Original version did INSERT through a 89M-cost CROSS JOIN LATERAL CTE that
-- timed out during deploy. Hotfix keeps только the GIST trgm index (this is
-- the load-bearing change for downstream queries — competitors fuzzy match,
-- objective_complex_mapping reverse matching).
--
-- Actual multi-feature INSERT was already done inline on 2026-05-17
-- (+13 mappings: 129 → 142). Remaining auto-accept candidates (~50-100 at
-- composite >= 0.75) will be applied via separate migration 117 after
-- the candidate query is pre-materialized to avoid full LATERAL scan.
CREATE INDEX IF NOT EXISTS objective_lots_project_name_trgm_idx
ON objective_lots USING gist (project_name gist_trgm_ops);