]> Untitled Git - lemmy.git/blob - migrations/2023-04-23-164732_add_person_details_indexes/up.sql
Split activity table into sent and received parts (fixes #3103) (#3583)
[lemmy.git] / migrations / 2023-04-23-164732_add_person_details_indexes / up.sql
1 -- Add a few indexes to speed up person details queries
2 create index idx_person_lower_name on person (lower(name));
3 create index idx_community_lower_name on community (lower(name));
4
5 create index idx_community_moderator_published on community_moderator (published);
6 create index idx_community_moderator_community on community_moderator (community_id);
7 create index idx_community_moderator_person on community_moderator (person_id);
8
9 create index idx_comment_saved_comment on comment_saved (comment_id);
10 create index idx_comment_saved_person on comment_saved (person_id);
11
12 create index idx_community_block_community on community_block (community_id);
13 create index idx_community_block_person on community_block (person_id);
14
15 create index idx_community_follower_community on community_follower (community_id);
16 create index idx_community_follower_person on community_follower (person_id);
17
18 create index idx_person_block_person on person_block (person_id);
19 create index idx_person_block_target on person_block (target_id);
20
21 create index idx_post_language on post (language_id);
22 create index idx_comment_language on comment (language_id);
23
24 create index idx_person_aggregates_person on person_aggregates (person_id);
25
26 create index idx_person_post_aggregates_post on person_post_aggregates (post_id);
27 create index idx_person_post_aggregates_person on person_post_aggregates (person_id);
28
29 create index idx_comment_reply_comment on comment_reply (comment_id);
30 create index idx_comment_reply_recipient on comment_reply (recipient_id);
31 create index idx_comment_reply_published on comment_reply (published desc);