fix(db): DROP dead BRIN index rosreestr_deals_period_brin #122
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#122
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "fix/drop-dead-brin-rosreestr"
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?
Summary
Per code review audit (May 14): BRIN index
rosreestr_deals_period_brinна partitioned parent — dead weight. PG16 НЕ propagates на child partitions; parent сам без данных; queries не trigger BRIN scan.Migration:
data/sql/89_drop_dead_brin_rosreestr_deals.sql— атомарный DROP с idempotentIF EXISTS.Cleanup:
01_schema_rosreestr_deals.sql:65-67— закомментировал CREATE с tombstone-note (fresh bootstrap не создаст заново).Why dead
rosreestr_dealsholds zero rows (все 7 child partitions содержат данные)pg_stat_user_indexes.idx_scan = 0(verify SELECT в migration file header)Apply на prod
После merge:
Verify SELECTы в header migration file:
idx_scanожидается 0 + индекс existed только на parent.Rollback path
Re-create per-partition если нужен (но обычно partition pruning достаточно):
Vault
fixes/Migration_Drop_Dead_Brin_May14.md— statusready_to_applyс verification + apply steps + rollback.Bot review
Аккуратный split: comment-out CREATE в
01_schema_*+ новый89_drop_*.sqlmigration сBEGIN/COMMIT,IF EXISTS, embedded verification SELECTs.✅ Merge безопасный — PR добавляет файл и комментирует строку. Сам
DROP INDEXНЕ выполняется автоматически на prod (нет migration runner); оператор запускает psql вручную по плану в PR body. Поэтому риск merge-time = 0.✅ Reversible — если
idx_scanоказывается > 0 (вопреки PG16-предположению),CREATE INDEXper-partition восстанавливает функциональность. Rollback path задокументирован в migration header.🟡 Pre-apply gate (для оператора, не блокер мерджа) — PR header честно говорит: «DB connection was unavailable at migration creation time. idx_scan=0 inferred». Перед
psql -f 89_drop_*.sqlобязательно запустить два verification SELECT'а из header migration файла (pg_stat_user_indexes.idx_scan+pg_indexesгде тaблица =rosreestr_dealsparent). Еслиidx_scan > 0— НЕ применять.CI
Мерджу когда frontend CI зелёный.
Tracking: part of audit batch #127. Vault:
fixes/Migration_Drop_Dead_Brin_May14.md.Final review (SHA
5acca40, CI ✅)approve merge