internal/db: add host indexes

This commit is contained in:
Johan Brandhorst-Satzkorn committed 2024-01-05 07:43:21 -08:00
1 parent 6f488d7c59
commit 21c593ab71
2 files changed
+37

No files matched your search

@@ -0,0 +1,22 @@
-- Copyright (c) HashiCorp, Inc.
-- SPDX-License-Identifier: BUSL-1.1
begin;
-- Add new indexes for the create time and update time queries.
create index host_plugin_host_create_time_public_id_idx
on host_plugin_host (create_time desc, public_id asc);
create index host_plugin_host_update_time_public_id_idx
on host_plugin_host (update_time desc, public_id asc);
analyze host_plugin_host;
-- Add new indexes for the create time and update time queries.
create index static_host_create_time_public_id_idx
on static_host (create_time desc, public_id asc);
create index static_host_update_time_public_id_idx
on static_host (update_time desc, public_id asc);
analyze static_host;
commit;
@@ -0,0 +1,15 @@
-- Copyright (c) HashiCorp, Inc.
-- SPDX-License-Identifier: BUSL-1.1
begin;
select plan(4);
select has_index('host_plugin_host', 'host_plugin_host_create_time_public_id_idx', array['create_time', 'public_id']);
select has_index('host_plugin_host', 'host_plugin_host_update_time_public_id_idx', array['update_time', 'public_id']);
select has_index('static_host', 'static_host_create_time_public_id_idx', array['create_time', 'public_id']);
select has_index('static_host', 'static_host_update_time_public_id_idx', array['update_time', 'public_id']);
select * from finish();
rollback;