on develop help sign in
denis/sql/indexes.sql
20 lines 1.6 kB history raw
1CREATE OR REPLACE FUNCTION my_array_to_text(text[])
2 RETURNS text LANGUAGE sql IMMUTABLE AS $$SELECT array_to_string($1, ' ')$$;
3CREATE INDEX "faculty_text" ON "faculties" USING GIN (to_tsvector('russian', "facultyName" || ' ' || "facultyPath" || ' ' || "facultyCampusName" || ' ' || my_array_to_text("facultyTags")));
4CREATE INDEX "faculty_name_path" ON "faculties" USING GIN (to_tsvector('russian', "facultyName" || ' ' || "facultyPath"));
5CREATE INDEX "faculty_name" ON "faculties" USING GIN (to_tsvector('russian', "facultyName"));
6CREATE INDEX group_chat_users ON "groupChats" USING gin ("groupChatUsers");
7CREATE INDEX message_author ON messages USING btree ("messageStorageAuthorId");
8CREATE INDEX message_group ON messages USING btree ("messageStorageDestinationGroupId");
9CREATE INDEX message_user ON messages USING btree ("messageStorageDestinationUserId");
10CREATE INDEX named_channel_owner ON channels USING btree ("namedChannelFullOwner");
11CREATE INDEX post_author ON posts USING btree ("postRowAuthorId");
12CREATE INDEX post_element_ord ON "postElements" USING btree ("rowElementId", "rowElementOrd");
13CREATE INDEX post_tags ON posts USING gin ("postRowTags");
14CREATE INDEX message_time on messages ("messageStorageTime");
15CREATE INDEX post_time on posts ("postRowUpdateTime");
16CREATE INDEX token_user on tokens ("tokenUserId");
17CREATE INDEX token_time on tokens ("tokenExpiryDate");
18CREATE INDEX token_value on tokens using hash ("tokenValue");
19CREATE INDEX token_activation on tokens using hash ("tokenActivationCode");
20CREATE INDEX token_deactivation on tokens using hash ("tokenDeactivationCode");