Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ CREATE INDEX idx_app_user_term_delete
ON application(site_user_id, term, is_delete);

CREATE INDEX idx_app_first_choice_search
ON application(verify_status, term, is_delete, first_choice_university_apply_info_id);
ON application(verify_status, term, is_delete, first_choice_university_info_for_apply_id);

CREATE INDEX idx_app_second_choice_search
ON application(verify_status, term, is_delete, second_choice_university_apply_info_id);
ON application(verify_status, term, is_delete, second_choice_university_info_for_apply_id);

CREATE INDEX idx_app_third_choice_search
ON application(verify_status, term, is_delete, third_choice_university_apply_info_id);
ON application(verify_status, term, is_delete, third_choice_university_info_for_apply_id);
Comment on lines 8 to +15
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

중복 인덱스 + 자동 컬럼 추적 오해

  1. 컬럼 RENAME 시 기존 인덱스는 내부적으로 새 컬럼명을 자동 추적합니다. 따라서 동일 이름으로 다시 CREATE INDEX 하면 충돌이 납니다.
  2. 해결 옵션
    기존 인덱스 재사용 → 본 구문(8–15라인) 자체를 제거.
    재생성 필요DROP INDEX IF EXISTSCREATE INDEX 실행.
  3. CONCURRENTLY 옵션을 사용하면 운영 중 락을 최소화할 수 있습니다(PostgreSQL 기준).
-DROP INDEX IF EXISTS idx_app_first_choice_search;
-DROP INDEX IF EXISTS idx_app_second_choice_search;
-DROP INDEX IF EXISTS idx_app_third_choice_search;
-
-CREATE INDEX idx_app_first_choice_search
-    ON application(verify_status, term, is_delete, first_choice_university_info_for_apply_id);
-CREATE INDEX idx_app_second_choice_search
-    ON application(verify_status, term, is_delete, second_choice_university_info_for_apply_id);
-CREATE INDEX idx_app_third_choice_search
-    ON application(verify_status, term, is_delete, third_choice_university_info_for_apply_id);
+-- 기존 인덱스 제거 후 재생성(필요 시 CONCURRENTLY 사용)
+DROP INDEX IF EXISTS idx_app_first_choice_search;
+CREATE INDEX idx_app_first_choice_search
+    ON application(verify_status, term, is_delete, first_choice_university_info_for_apply_id);
+
+DROP INDEX IF EXISTS idx_app_second_choice_search;
+CREATE INDEX idx_app_second_choice_search
+    ON application(verify_status, term, is_delete, second_choice_university_info_for_apply_id);
+
+DROP INDEX IF EXISTS idx_app_third_choice_search;
+CREATE INDEX idx_app_third_choice_search
+    ON application(verify_status, term, is_delete, third_choice_university_info_for_apply_id);

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In
src/main/resources/db/migration/V13__add_application_index_and_delete_manny_to_one_mapping.sql
lines 8 to 15, the script attempts to create indexes that likely already exist
due to column renaming automatically updating index definitions, causing
conflicts. To fix this, either remove these CREATE INDEX statements entirely to
reuse existing indexes or modify the script to first drop the indexes if they
exist using DROP INDEX IF EXISTS, then recreate them with CREATE INDEX
CONCURRENTLY to minimize locking during operation.