Skip to content

Additional db indexes#201

Closed
evanpetzoldt wants to merge 3 commits intodevfrom
feat-new-db-indexes
Closed

Additional db indexes#201
evanpetzoldt wants to merge 3 commits intodevfrom
feat-new-db-indexes

Conversation

@evanpetzoldt
Copy link
Copy Markdown
Collaborator

Small PR to add some new db indexes. This is primarily to address some slowness in some of the hourly script queries used in Slackbot.

event_instances

  • start_date index - should speed up most of our queries

slack_users

  • index on Slack's ids as this is often how slackbot looks users up

attendance_x_attendance_types

  • just adding one for attendance_type

@evanpetzoldt evanpetzoldt marked this pull request as ready for review March 29, 2026 11:43
@taterhead247
Copy link
Copy Markdown
Contributor

Well this is awkward. I already co figured and applied drizzle migration 11. 🤦‍♂️ I did it in https://github.com/F3-Nation/f3-nation/tree/feat/auth/packages/db/drizzle (feat/auth branch). It should have been in dev by now but the need to upgrade to Node 24 was an unexpected delay. So this migration would fail. Later today I can move my migration code into dev and then I'll do a PR on your PR to update this. Sorry about that.

@evanpetzoldt
Copy link
Copy Markdown
Collaborator Author

@taterhead247 ah, ok no worries. We need to pull this in soon though, the db is having another bad day

@evanpetzoldt
Copy link
Copy Markdown
Collaborator Author

I mean heck, this PR doesn't even require any structural changes, so we could safely apply outside the "official" process if we wanted to get it in sooner

taterhead247 added a commit that referenced this pull request Mar 30, 2026
- idx_event_instances_start_date on event_instances.start_date
- idx_event_instances_start_date_active (partial, WHERE is_active)
- idx_slack_users_user_team_id on slack_users (user_id, slack_team_id)
- idx_attendance_x_types_type_id on attendance_x_attendance_types

Replaces PR #201 with correct migration numbering after auth migrations.
taterhead247 added a commit that referenced this pull request Mar 30, 2026
- idx_event_instances_start_date on event_instances.start_date
- idx_event_instances_start_date_active (partial, WHERE is_active)
- idx_slack_users_user_team_id on slack_users (user_id, slack_team_id)
- idx_attendance_x_types_type_id on attendance_x_attendance_types

Replaces PR #201 with correct migration numbering after auth migrations.
taterhead247 added a commit that referenced this pull request Mar 30, 2026
- idx_event_instances_start_date on event_instances.start_date
- idx_event_instances_start_date_active (partial, WHERE is_active)
- idx_slack_users_user_team_id on slack_users (user_id, slack_team_id)
- idx_attendance_x_types_type_id on attendance_x_attendance_types

Replaces PR #201 with correct migration numbering after auth migrations.
taterhead247 added a commit that referenced this pull request Mar 30, 2026
- idx_event_instances_start_date on event_instances.start_date
- idx_event_instances_start_date_active (partial, WHERE is_active)
- idx_slack_users_user_team_id on slack_users (user_id, slack_team_id)
- idx_attendance_x_types_type_id on attendance_x_attendance_types

Replaces PR #201 with correct migration numbering after auth migrations.
@taterhead247
Copy link
Copy Markdown
Contributor

@evanpetzoldt , I merged my 11/12 (which had already been migrated) then updated yours to bee 13, then migrated it into Prod and staging. Let me know if you see anything off. Drizzle code is sitting in dev branch. But it's been migrated to both staging and prod.

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

Labels

None yet

Projects

Status: Merged

Development

Successfully merging this pull request may close these issues.

2 participants