Multi-Source Integration Phase 3.1. Foundation for /api/v1/search p95 < 100ms
on 100K+ listings.
SQL 050_search_optimization.sql:
- CREATE EXTENSION IF NOT EXISTS pg_trgm
- ALTER listings ADD COLUMN tsv tsvector GENERATED ALWAYS AS (...) STORED
- 10 indexes (geom GIST, composite, gin_trgm, GIN tsv, partial kadastr, ...)
- CREATE MATERIALIZED VIEW listings_search_mv (per-listing aggregated across sources)
- 5 matview indexes
Celery task tradein.refresh_search_matview:
- REFRESH MATERIALIZED VIEW CONCURRENTLY listings_search_mv
- Logged duration via logger.info
- Beat schedule snippet (crontab hour=3, minute=0) in docstring — wiring to
app/celery_app.py left to follow-up PR per main-session coordination.
Refs Master Plan sec 5.1 + 6.5 + 10.1.
0 lines
Python
0 lines
Python