Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix(coderd/database): add fk index for workspace_agent_scripts #12791

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix(coderd/database): add fk index for workspace_agent_scripts
I noticed we were missing this index while looking at query
performances, we were doing sequential scans on the table via the
`GetWorkspaceAgentScriptsByAgentIDs` query, which is relatively fast
whilst the table is small, but at 8.5k calls/hour in our dogfood
instance, it will become problematic eventually.
  • Loading branch information
mafredri committed Mar 28, 2024
commit f33ca15c1d0925fceedafe86457439ba4503db6c
4 changes: 4 additions & 0 deletions coderd/database/dump.sql

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DROP INDEX workspace_agent_scripts_workspace_agent_id_idx;
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
CREATE INDEX workspace_agent_scripts_workspace_agent_id_idx ON workspace_agent_scripts (workspace_agent_id);

COMMENT ON INDEX workspace_agent_scripts_workspace_agent_id_idx IS 'Foreign key support index for faster lookups';