Skip to content

複合インデックスと重複する単独インデックスを削除 #9915 - #10344

Open
JoeJoeflyn wants to merge 1 commit into
fjordllc:mainfrom
JoeJoeflyn:chore/remove-redundant-indexes-#9915
Open

JoeJoeflyn wants to merge 1 commit into
fjordllc:mainfrom
JoeJoeflyn:chore/remove-redundant-indexes-#9915

Conversation

@JoeJoeflyn

Copy link
Copy Markdown
Contributor

Issue

概要

複合インデックスの先頭カラムと重複する単独インデックスを11件削除しました。PostgreSQLのB-treeインデックスでは複合インデックスの先頭カラム単体での検索にも利用されるため、単独インデックスは冗長です。

削除対象

テーブル 削除したインデックス 代替となる複合インデックス
answers index_answers_on_question_id index_answers_on_question_id_and_type
checks index_checks_on_user_id index_checks_on_user_id_and_checkable_id_and_checkable_type
coding_test_submissions index_coding_test_submissions_on_coding_test_id index_coding_test_submissions_on_coding_test_id_and_user_id
followings index_followings_on_follower_id index_followings_on_follower_id_and_followed_id
footprints index_footprints_on_user_id index_footprintable
pair_work_schedules index_pair_work_schedules_on_pair_work_id index_pair_work_schedules_on_pair_work_id_and_proposed_at
participations index_participations_on_user_id index_participations_on_user_id_and_event_id
products index_products_on_user_id index_products_on_user_id_and_practice_id
regular_event_participations index_regular_event_participations_on_user_id index_user_id_and_regular_event_id
survey_answers index_survey_answers_on_survey_id index_survey_answers_on_survey_id_and_user_id
works index_works_on_user_id index_works_on_user_id_and_title

変更確認方法

  1. chore/remove-redundant-indexes-#9915 をローカルに取り込む
  2. bin/rails db:migrate を実行し、エラーなく完了することを確認する
  3. bin/rails db:schema:load でスキーマが正しく構築されることを確認する
  4. bin/rails test が全てパスすることを確認する

@coderabbitai

coderabbitai Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@JoeJoeflyn, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 17 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 36740d87-cd62-4f7b-8eea-668886cb9920

📥 Commits

Reviewing files that changed from the base of the PR and between 26efdec and f88e7a9.

📒 Files selected for processing (10)
  • db/migrate/20260728000001_remove_index_question_id_from_answers.rb
  • db/migrate/20260728000002_remove_index_user_id_from_checks.rb
  • db/migrate/20260728000003_remove_index_coding_test_id_from_coding_test_submissions.rb
  • db/migrate/20260728000004_remove_index_follower_id_from_followings.rb
  • db/migrate/20260728000005_remove_index_user_id_from_footprints.rb
  • db/migrate/20260728000006_remove_index_pair_work_id_from_pair_work_schedules.rb
  • db/migrate/20260728000007_remove_index_user_id_from_participations.rb
  • db/migrate/20260728000008_remove_index_user_id_from_products.rb
  • db/migrate/20260728000009_remove_index_user_id_from_regular_event_participations.rb
  • db/schema.rb
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant