Skip to content

Add missing indexes on foreign keys and frequently queried columns #2396

@gnclmorais

Description

@gnclmorais

Description of the issue 📄

Our website is good but it could be better, namely regarding speed in a few places. Running Claude Code on the repo, it suggested adding a few missing database indexes that, according to it, would “10-100x faster queries on foreign key lookups”.

Steps to fix 🛠

Add the following indexes in a migration:

    add_index :invitations, :event_id unless index_exists?(:invitations, :event_id)
    add_index :invitations, :member_id unless index_exists?(:invitations, :member_id)
    add_index :workshop_invitations, :workshop_id unless index_exists?(:workshop_invitations, :workshop_id)
    add_index :workshop_invitations, :member_id unless index_exists?(:workshop_invitations, :member_id)
    add_index :events, :date_and_time unless index_exists?(:events, :date_and_time)
    add_index :attendances, [:attendable_type, :attendable_id] unless index_exists?(:attendances, [:attendable_type, :attendable_id])

To do 📋

  • Claim this issue (comment below, or assign yourself if you are part of the codebar org)
  • Fork and clone the repository
  • Update the relevant files. Follow the steps to fix section in this issue.
  • Commit your changes as one commit. Use the title of this issue as your commit message
  • Submit a pull request
  • Mention this issue in the PR description by including it's number
  • Have your pull request reviewed & merged by a codebar team member

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions