perf(estimate): trigram expr index for same-building anchor Tier A (~94x) #1946
No reviewers
Labels
No labels
admin
analytics
auth
automation
bug
business
chore
ci
compliance
data
data-moat
docs
duplicate
dx
enhancement
Fable 5 ревью
feedback/max
generative
GG-форсайт
needs-discussion
needs-human
observability
pause-bots
performance
priority/p0
priority/p1
priority/p2
priority/p3
scope/backend
scope/db
scope/devops
scope/frontend
scope/qa
scrapers
security
site-finder
stage/1
stage/2
status/blocked
status/done
status/needs-analysis
status/needs-fix
status/qa
status/ready
status/review
status/wip
tech-debt
tradein
ux
week ревью 1
wontfix
вторичка
ИРД
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: lekss361/gendesign#1946
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "perf/tradein-estimate-audit"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Что
GIN trigram expression-индекс на
lower(translate(address,'ёЁ','ее'))для same-building anchor Tier A эстиматора.Почему (perf-аудит /estimate)
_fetch_anchor_compsTier A запускается на КАЖДОЙ оценке (флагestimate_same_building_anchor_enabledдефолт True, в проде не переопределён). Предикат оборачиваетaddressвlower(translate(address,'ёЁ','ее'))для LIKE'%street%'И~regex по номеру дома — non-sargable. Существующийlistings_address_trgm_idxна СЫРОМ address → не применим → Seq Scan по всем ~66.7k listings (167ms) на каждой оценке.Доказательство (prod EXPLAIN, BEGIN/ROLLBACK, "Хохрякова 48")
listings_addr_norm_trgm_idxgin_trgm_opsобслуживает И LIKE, И regex. Result-identical (count/sum/min/max совпали — чистый access-path). Независимо перепроверил dry-run'ом: Bitmap Index Scan, 0.66ms.Безопасность
WHERE address IS NOT NULL(partial). pg_trgm на проде есть.listings_address_trgm_idx(raw address) оставлен — нужен др. путям.database-expert проверил весь estimate-hot-path: Tier W/H (geom+rooms BitmapAnd) и Tier S (house_id_fk) уже оптимальны — других индексов не нужно. Migration
tradein-mvp/backend/data/sql/137.