feat: modify `workspace_agent_stats` index (#10073)

This commit is contained in:
Marcin Tojek 2023-10-05 14:49:08 +02:00 committed by GitHub
parent 30440915bc
commit ab9276bd08
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 1 deletions

View File

@ -1351,7 +1351,7 @@ CREATE UNIQUE INDEX users_username_lower_idx ON users USING btree (lower(usernam
CREATE INDEX workspace_agent_startup_logs_id_agent_id_idx ON workspace_agent_logs USING btree (agent_id, id);
CREATE INDEX workspace_agent_stats_template_id_created_at_user_id_idx ON workspace_agent_stats USING btree (template_id, created_at DESC, user_id) WHERE (connection_count > 0);
CREATE INDEX workspace_agent_stats_template_id_created_at_user_id_idx ON workspace_agent_stats USING btree (template_id, created_at, user_id) INCLUDE (session_count_vscode, session_count_jetbrains, session_count_reconnecting_pty, session_count_ssh, connection_median_latency_ms) WHERE (connection_count > 0);
COMMENT ON INDEX workspace_agent_stats_template_id_created_at_user_id_idx IS 'Support index for template insights endpoint to build interval reports faster.';

View File

@ -0,0 +1,5 @@
DROP INDEX workspace_agent_stats_template_id_created_at_user_id_idx;
CREATE INDEX workspace_agent_stats_template_id_created_at_user_id_idx ON workspace_agent_stats USING btree (template_id, created_at DESC, user_id) WHERE connection_count > 0;
COMMENT ON INDEX workspace_agent_stats_template_id_created_at_user_id_idx IS 'Support index for template insights endpoint to build interval reports faster.';

View File

@ -0,0 +1,5 @@
DROP INDEX workspace_agent_stats_template_id_created_at_user_id_idx;
CREATE INDEX workspace_agent_stats_template_id_created_at_user_id_idx ON workspace_agent_stats (template_id, created_at, user_id) INCLUDE (session_count_vscode, session_count_jetbrains, session_count_reconnecting_pty, session_count_ssh, connection_median_latency_ms) WHERE connection_count > 0;
COMMENT ON INDEX workspace_agent_stats_template_id_created_at_user_id_idx IS 'Support index for template insights endpoint to build interval reports faster.';