diff --git a/coderd/database/dump.sql b/coderd/database/dump.sql index 7411f7c2abe..1f5afd43d2c 100644 --- a/coderd/database/dump.sql +++ b/coderd/database/dump.sql @@ -5101,8 +5101,6 @@ CREATE INDEX idx_chat_debug_runs_chat_started ON chat_debug_runs USING btree (ch CREATE UNIQUE INDEX idx_chat_debug_runs_id_chat ON chat_debug_runs USING btree (id, chat_id); -CREATE INDEX idx_chat_debug_runs_stale ON chat_debug_runs USING btree (updated_at) WHERE (finished_at IS NULL); - CREATE INDEX idx_chat_debug_runs_updated_at ON chat_debug_runs USING btree (updated_at); CREATE INDEX idx_chat_debug_steps_chat_assistant_msg ON chat_debug_steps USING btree (chat_id, assistant_message_id) WHERE (assistant_message_id IS NOT NULL); @@ -5111,8 +5109,6 @@ CREATE INDEX idx_chat_debug_steps_chat_tip ON chat_debug_steps USING btree (chat CREATE UNIQUE INDEX idx_chat_debug_steps_run_step ON chat_debug_steps USING btree (run_id, step_number); -CREATE INDEX idx_chat_debug_steps_stale ON chat_debug_steps USING btree (updated_at) WHERE (finished_at IS NULL); - CREATE INDEX idx_chat_diff_statuses_pr_title_fts ON chat_diff_statuses USING gin (to_tsvector('simple'::regconfig, pull_request_title)); CREATE INDEX idx_chat_diff_statuses_stale_at ON chat_diff_statuses USING btree (stale_at); diff --git a/coderd/database/migrations/000632_drop_chat_debug_stale_indexes.down.sql b/coderd/database/migrations/000632_drop_chat_debug_stale_indexes.down.sql new file mode 100644 index 00000000000..c3c15f56b9b --- /dev/null +++ b/coderd/database/migrations/000632_drop_chat_debug_stale_indexes.down.sql @@ -0,0 +1,2 @@ +CREATE INDEX idx_chat_debug_runs_stale ON chat_debug_runs(updated_at) WHERE finished_at IS NULL; +CREATE INDEX idx_chat_debug_steps_stale ON chat_debug_steps(updated_at) WHERE finished_at IS NULL; diff --git a/coderd/database/migrations/000632_drop_chat_debug_stale_indexes.up.sql b/coderd/database/migrations/000632_drop_chat_debug_stale_indexes.up.sql new file mode 100644 index 00000000000..20287d5ed2c --- /dev/null +++ b/coderd/database/migrations/000632_drop_chat_debug_stale_indexes.up.sql @@ -0,0 +1,4 @@ +-- These partial indexes served only the FinalizeStaleChatDebugRows query, +-- which was deleted with the stale debug-run sweep. +DROP INDEX idx_chat_debug_runs_stale; +DROP INDEX idx_chat_debug_steps_stale;