This commit is contained in:
@@ -39,7 +39,7 @@ namespace AyaNova.Util
|
||||
|
||||
|
||||
HOW TO INDEX
|
||||
|
||||
https://www.postgresqltutorial.com/postgresql-indexes/postgresql-create-index/
|
||||
AyaNova does a lot of name fetching so any tables that contain a lot of columns in addition to the name will benefit from a compound index on (id,name)
|
||||
|
||||
Other indexes should be created with care and after a huge load and integration test periodically look for unused indexes and see how they are performing
|
||||
@@ -487,6 +487,28 @@ $BODY$;
|
||||
"sent timestamp not null, viewed bool default false, replied bool default false, fromid bigint not null REFERENCES auser(id), toid bigint not null REFERENCES auser(id) )");
|
||||
await ExecQueryAsync("CREATE INDEX amemo_tags ON amemo using GIN(tags)");
|
||||
|
||||
//REMINDER
|
||||
await ExecQueryAsync("CREATE TABLE areminder (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, name text not null, " +
|
||||
"notes text, wiki text, customfields text, tags varchar(255) ARRAY, " +
|
||||
"startdate timestamp not null, stopdate timestamp not null, userid bigint not null references auser(id), color varchar(12) not null default '#ffffff')");
|
||||
|
||||
await ExecQueryAsync("CREATE INDEX areminder_userid_idx ON areminder (userid);");
|
||||
await ExecQueryAsync("CREATE INDEX areminder_startdate_idx ON areminder (startdate);");
|
||||
await ExecQueryAsync("CREATE INDEX areminder_stopdate_idx ON areminder (stopdate);");
|
||||
await ExecQueryAsync("CREATE INDEX areminder_tags ON areminder using GIN(tags)");
|
||||
|
||||
//REVIEW
|
||||
await ExecQueryAsync("CREATE TABLE areview (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, name text not null, " +
|
||||
"notes text, wiki text, customfields text, tags varchar(255) ARRAY, " +
|
||||
"duedate timestamp not null, completeddate timestamp null, completionnotes text, userid bigint not null references auser(id), " +
|
||||
"assignedbyuserid bigint not null references auser(id), objecttype integer not null, objectid bigint not null)");
|
||||
|
||||
await ExecQueryAsync("CREATE INDEX areview_typeid_idx ON areview (objectid, objecttype );");
|
||||
await ExecQueryAsync("CREATE INDEX areview_userid_idx ON areview (userid);");
|
||||
await ExecQueryAsync("CREATE INDEX areview_duedate_idx ON areview (duedate);");
|
||||
await ExecQueryAsync("CREATE INDEX areview_completeddate_idx ON areview (completeddate);");
|
||||
await ExecQueryAsync("CREATE INDEX areview_tags ON areview using GIN(tags)");
|
||||
|
||||
//CUSTOMER
|
||||
await ExecQueryAsync("CREATE TABLE acustomer (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, name text not null unique, active bool, " +
|
||||
"notes text, wiki text, customfields text, tags varchar(255) ARRAY, " +
|
||||
|
||||
Reference in New Issue
Block a user