Added indexes to support frontpercent query changes

Note: need to determine conventions to use for index names and settings going forward. There are also some indexes in production that aren't in here and are probably good additions to a standard set.
This commit is contained in:
Noko 2019-10-05 15:30:55 -05:00
parent 845ec90c3e
commit bc0213c9a1

View File

@ -49,6 +49,10 @@ create table if not exists switches
system serial not null references systems (id) on delete cascade, system serial not null references systems (id) on delete cascade,
timestamp timestamp not null default (current_timestamp at time zone 'utc') timestamp timestamp not null default (current_timestamp at time zone 'utc')
); );
CREATE INDEX IF NOT EXISTS idx_switches_system
ON switches USING btree (
system ASC NULLS LAST
) INCLUDE ("timestamp");
create table if not exists switch_members create table if not exists switch_members
( (
@ -56,6 +60,10 @@ create table if not exists switch_members
switch serial not null references switches (id) on delete cascade, switch serial not null references switches (id) on delete cascade,
member serial not null references members (id) on delete cascade member serial not null references members (id) on delete cascade
); );
CREATE INDEX IF NOT EXISTS idx_switch_members_switch
ON switch_members USING btree (
switch ASC NULLS LAST
) INCLUDE (member);
create table if not exists webhooks create table if not exists webhooks
( (