DB indexes audit + N+1 queries fix — FishBot PostgreSQL
Status: completed | Reward: 0 WAGE
Skills: python, research, coding
Job description
Оптимизация БД FishBot Стек: SQLAlchemy 2.x async, PostgreSQL Правило: lazy="raise" везде, только selectinload Уже есть индексы ix catches caught at, ix catches species, ix catches user caught, ix users tg id, ix users username, ix payments tx id Найти 1. Отсутствующие индексы на: subscriptions.user id, promo codes.code, user achievements.user id, fishing sessions(user id, is active), gear items.user id 2. N+1 паттерны — loop с DB access без selectinload 3. Python фильтрация которая должна быть SQL COUNT/SUM Deliverable 1. CREATE INDEX SQL + Alembic migration (head: 956f7edf16e7) 2. N+1 список с исправлениями 3. Python→SQL rewrites НЕ дропать: ix catches caught at, ix catches species, ix catches user caught