diff --git a/postgres-init/migrations/0011_area_contents_status_index.sql b/postgres-init/migrations/0011_area_contents_status_index.sql new file mode 100644 index 0000000..e903c2a --- /dev/null +++ b/postgres-init/migrations/0011_area_contents_status_index.sql @@ -0,0 +1,10 @@ +-- 0011 · area_contents 상태 조회 인덱스 — init.sql 에만 있고 옛 DB 에는 없던 것 +-- +-- ★ 어떻게 찾았나 (2026-09-11) +-- 킹서버 덤프 복원본에 0000~0010 을 돌린 DB 와 init.sql 로 새로 세운 DB 를 나란히 찍어 비교했다 +-- (0009 가 적은 방법 그대로). 컬럼·표는 전부 같았고 이 인덱스 하나만 새 DB 에만 있었다 — +-- 킹서버 DB 가 이 인덱스가 init.sql 에 들어가기 전에 세워졌기 때문이다. +-- ★ 동작에는 영향이 없다. 수집 상태로 area_contents 를 거를 때 시퀀셜 스캔이 될 뿐이다. + +CREATE INDEX IF NOT EXISTS idx_local_contents_status ON public.area_contents (status, collected_at DESC) + WHERE deleted = FALSE;