diff --git a/CHANGELOG.md b/CHANGELOG.md index a26f9db580..1f129b3778 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -66,6 +66,9 @@ Canonical reference for changes, improvements, and bugfixes for Boundary. * resource listing: API requests to list a resource (targets, sessions, users, etc) now properly return all resources the callers has appropriate permission to list ([PR](https://github.com/hashicorp/boundary/pull/3278)) +* sessions: Fix a bug that contributed to slow response times when listing + sessions that had a large number of connections + ([PR](https://github.com/hashicorp/boundary/pull/3280)) ## 0.12.3 (2023/05/26) diff --git a/internal/db/schema/migrations/oss/postgres/69/02_session_worker_protocol.up.sql b/internal/db/schema/migrations/oss/postgres/69/02_session_worker_protocol.up.sql index 2b0100f7df..53ab2d2e16 100644 --- a/internal/db/schema/migrations/oss/postgres/69/02_session_worker_protocol.up.sql +++ b/internal/db/schema/migrations/oss/postgres/69/02_session_worker_protocol.up.sql @@ -18,6 +18,7 @@ begin; drop view session_list; -- Replaces view from 60/02_sessions.up.sql to add swp.worker_id + -- Replaced in 72/03_session_list_perf_fix.up.sql create view session_list as select s.public_id, diff --git a/internal/db/schema/migrations/oss/postgres/72/03_session_list_perf_fix.up.sql b/internal/db/schema/migrations/oss/postgres/72/03_session_list_perf_fix.up.sql new file mode 100644 index 0000000000..e41a8c6587 --- /dev/null +++ b/internal/db/schema/migrations/oss/postgres/72/03_session_list_perf_fix.up.sql @@ -0,0 +1,40 @@ +-- Copyright (c) HashiCorp, Inc. +-- SPDX-License-Identifier: MPL-2.0 + +begin; + + -- Replaces the view created in 69/02_session_worker_protocol.up.sql + drop view session_list; + create view session_list as + select s.public_id, + s.user_id, + shsh.host_id, + s.target_id, + shsh.host_set_id, + s.auth_token_id, + s.project_id, + s.certificate, + s.certificate_private_key, + s.expiration_time, + s.connection_limit, + s.tofu_token, + s.key_id, + s.termination_reason, + s.version, + s.create_time, + s.update_time, + s.endpoint, + s.worker_filter, + s.egress_worker_filter, + s.ingress_worker_filter, + swp.worker_id, + ss.state, + ss.previous_end_time, + ss.start_time, + ss.end_time + from session s + join session_state ss on s.public_id = ss.session_id + left join session_host_set_host shsh on s.public_id = shsh.session_id + left join session_worker_protocol swp on s.public_id = swp.session_id; + +commit;