Skip to content

perf(api): index the module join tables#366

Open
cavidelizade wants to merge 1 commit into
Devlaner:mainfrom
cavidelizade:fix/module-join-indexes
Open

perf(api): index the module join tables#366
cavidelizade wants to merge 1 commit into
Devlaner:mainfrom
cavidelizade:fix/module-join-indexes

Conversation

@cavidelizade

Copy link
Copy Markdown
Contributor

Summary

The module join tables (module_issues, module_members, module_links) had no indexes, so every lookup by module_id or issue_id was a sequential scan. The cycle join tables already have the equivalent indexes.

Linked issues

Refs #346 (the index half)

Type of change

  • Performance (perf:)

Surface

  • API (apps/api/)
  • Database migration (apps/api/migrations/)

What changed

Migration 000014 adds idx_module_issues_module, idx_module_issues_issue, idx_module_members_module and idx_module_links_module, using CREATE INDEX IF NOT EXISTS so it's safe to re-run.

Scope note

Issue #346 also flags N+1 association loading in the issue list/detail paths. That's a larger refactor (batching assignees/labels/cycles/modules), so I've left it for a separate PR and kept this one to the indexes.

Migration ordering

I have another open PR (#350) that adds 000013. This one is 000014, so it should merge after #350 to keep the sequence clean. Happy to renumber if you'd prefer.

Test plan

  • go build, go vet, go test ./... green; migration applies as plain CREATE INDEX IF NOT EXISTS

AI assistance

  • AI tools were used, tool(s): Claude Code (Opus 4.8), commits carry a Co-Authored-By: trailer

module_issues, module_members and module_links had no indexes, so every lookup
by module_id or issue_id was a sequential scan, while the cycle join tables
already have the equivalent indexes. Add them in migration 000014.

This covers the index half of Devlaner#346. The N+1 association loading it also
mentions is a larger refactor and is left for a follow-up.

Refs Devlaner#346

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@cavidelizade
cavidelizade requested a review from a team as a code owner July 16, 2026 21:11
@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown

Warning

Review limit reached

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

Next review available in: 50 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: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: f88b6c35-657a-40be-9bbf-0cc54e46ba16

📥 Commits

Reviewing files that changed from the base of the PR and between 61bc903 and 20b923f.

📒 Files selected for processing (2)
  • apps/api/migrations/000014_module_join_indexes.down.sql
  • apps/api/migrations/000014_module_join_indexes.up.sql
✨ 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.

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