perf: add composite index on user_workspace(workspace_id, role) #51

Open
Charon wants to merge 1 commit from feat/add-workspace-role-index into dev
Member

Summary

  • Adds a composite index on user_workspace(workspace_id, role) to eliminate full table scans for role-filtered workspace queries (e.g. "get all owners of workspace X")
  • New migration: 2026_03_24_000000_add_workspace_role_composite_index.php

Fixes #11

Test plan

  • Run composer test to verify existing tests pass
  • Run migration on a fresh database and confirm index is created
  • Verify rollback drops the index cleanly
## Summary - Adds a composite index on `user_workspace(workspace_id, role)` to eliminate full table scans for role-filtered workspace queries (e.g. "get all owners of workspace X") - New migration: `2026_03_24_000000_add_workspace_role_composite_index.php` Fixes #11 ## Test plan - [ ] Run `composer test` to verify existing tests pass - [ ] Run migration on a fresh database and confirm index is created - [ ] Verify rollback drops the index cleanly
Charon added 1 commit 2026-03-24 13:03:41 +00:00
Queries filtering by workspace_id and role (e.g. "get all owners of
workspace X") required a full table scan on the user_workspace pivot
table. This adds a composite index to cover those lookups efficiently.

Fixes #11

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin feat/add-workspace-role-index:feat/add-workspace-role-index
git checkout feat/add-workspace-role-index

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git checkout dev
git merge --no-ff feat/add-workspace-role-index
git checkout feat/add-workspace-role-index
git rebase dev
git checkout dev
git merge --ff-only feat/add-workspace-role-index
git checkout feat/add-workspace-role-index
git rebase dev
git checkout dev
git merge --no-ff feat/add-workspace-role-index
git checkout dev
git merge --squash feat/add-workspace-role-index
git checkout dev
git merge --ff-only feat/add-workspace-role-index
git checkout dev
git merge feat/add-workspace-role-index
git push origin dev
Sign in to join this conversation.
No description provided.