Skip to content

Commit

Permalink
schema/pgsql: Add missing indices to hostgroup and servicegroup
Browse files Browse the repository at this point in the history
  • Loading branch information
julianbrost committed Aug 1, 2023
1 parent f46193a commit de09001
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
12 changes: 10 additions & 2 deletions schema/pgsql/schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,8 @@ ALTER TABLE hostgroup ALTER COLUMN name_checksum SET STORAGE PLAIN;
ALTER TABLE hostgroup ALTER COLUMN properties_checksum SET STORAGE PLAIN;
ALTER TABLE hostgroup ALTER COLUMN zone_id SET STORAGE PLAIN;

CREATE INDEX idx_hostgroup_display_name ON hostgroup(display_name);
CREATE INDEX idx_hostgroup_name_ci ON hostgroup(name_ci);
CREATE INDEX idx_hostgroup_name ON hostgroup(name);

COMMENT ON COLUMN hostgroup.id IS 'sha1(environment.id + name)';
Expand All @@ -313,7 +315,9 @@ COMMENT ON COLUMN hostgroup.name_checksum IS 'sha1(name)';
COMMENT ON COLUMN hostgroup.properties_checksum IS 'sha1(all properties)';
COMMENT ON COLUMN hostgroup.zone_id IS 'zone.id';

COMMENT ON INDEX idx_hostgroup_name IS 'Host/service/host group list filtered by host group name';
COMMENT ON INDEX idx_hostgroup_display_name IS 'Hostgroup list filtered/ordered by display_name';
COMMENT ON INDEX idx_hostgroup_name_ci IS 'Hostgroup list filtered using quick search';
COMMENT ON INDEX idx_hostgroup_name IS 'Host/service/host group list filtered by host group name; Hostgroup detail filter';

CREATE TABLE hostgroup_member (
id bytea20 NOT NULL,
Expand Down Expand Up @@ -577,8 +581,12 @@ COMMENT ON COLUMN servicegroup.name_checksum IS 'sha1(name)';
COMMENT ON COLUMN servicegroup.properties_checksum IS 'sha1(all properties)';
COMMENT ON COLUMN servicegroup.zone_id IS 'zone.id';

CREATE INDEX idx_servicegroup_display_name ON servicegroup(display_name);
CREATE INDEX idx_servicegroup_name_ci ON servicegroup(name_ci);
CREATE INDEX idx_servicegroup_name ON servicegroup(name);
COMMENT ON INDEX idx_servicegroup_name IS 'Host/service/service group list filtered by service group name';
COMMENT ON INDEX idx_servicegroup_display_name IS 'Servicegroup list filtered/ordered by display_name';
COMMENT ON INDEX idx_servicegroup_name_ci IS 'Servicegroup list filtered using quick search';
COMMENT ON INDEX idx_servicegroup_name IS 'Host/service/service group list filtered by service group name; Servicegroup detail filter';

CREATE TABLE servicegroup_member (
id bytea20 NOT NULL,
Expand Down
12 changes: 12 additions & 0 deletions schema/pgsql/upgrades/1.2.0.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,15 @@ ALTER TABLE customvar_flat ALTER COLUMN flatvalue DROP NOT NULL;

CREATE INDEX idx_customvar_flat_flatname_flatvalue ON customvar_flat(flatname, flatvalue);
COMMENT ON INDEX idx_customvar_flat_flatname_flatvalue IS 'Lists filtered by custom variable';

CREATE INDEX idx_hostgroup_display_name ON hostgroup(display_name);
CREATE INDEX idx_hostgroup_name_ci ON hostgroup(name_ci);
COMMENT ON INDEX idx_hostgroup_display_name IS 'Hostgroup list filtered/ordered by display_name';
COMMENT ON INDEX idx_hostgroup_name_ci IS 'Hostgroup list filtered using quick search';
COMMENT ON INDEX idx_hostgroup_name IS 'Host/service/host group list filtered by host group name; Hostgroup detail filter';

CREATE INDEX idx_servicegroup_display_name ON servicegroup(display_name);
CREATE INDEX idx_servicegroup_name_ci ON servicegroup(name_ci);
COMMENT ON INDEX idx_servicegroup_display_name IS 'Servicegroup list filtered/ordered by display_name';
COMMENT ON INDEX idx_servicegroup_name_ci IS 'Servicegroup list filtered using quick search';
COMMENT ON INDEX idx_servicegroup_name IS 'Host/service/service group list filtered by service group name; Servicegroup detail filter';

0 comments on commit de09001

Please sign in to comment.