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

Skip to content

Commit f33ca15

Browse files
committed
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.
1 parent d734f3f commit f33ca15

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

coderd/database/dump.sql

+4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
DROP INDEX workspace_agent_scripts_workspace_agent_id_idx;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
CREATE INDEX workspace_agent_scripts_workspace_agent_id_idx ON workspace_agent_scripts (workspace_agent_id);
2+
3+
COMMENT ON INDEX workspace_agent_scripts_workspace_agent_id_idx IS 'Foreign key support index for faster lookups';

0 commit comments

Comments
 (0)