Skip to content

Commit 80a6e6c

Browse files
authored
Add some missing indexes (#297)
Signed-off-by: Sergio Castaño Arteaga <[email protected]>
1 parent 72d168d commit 80a6e6c

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
-- job_project table
2+
create index job_project_job_id_idx on job_project (job_id);
3+
create index job_project_project_id_idx on job_project (project_id);
4+
5+
-- job table
6+
create index job_published_at_idx on job (published_at);
7+
create index job_published_at_desc_idx on job (published_at DESC) where status = 'published';
8+
create index job_created_at_idx on job (created_at);
9+
create index job_first_published_at_idx on job (first_published_at);
10+
create index job_salary_max_usd_year_idx on job (salary_max_usd_year);
11+
create index job_open_source_idx on job (open_source);
12+
create index job_upstream_commitment_idx on job (upstream_commitment);
13+
create index job_seniority_idx on job (seniority);
14+
15+
-- job_views table
16+
create index job_views_job_id_idx on job_views (job_id);
17+
create index job_views_day_idx on job_views (day);
18+
create index job_views_job_id_day_idx on job_views (job_id, day);
19+
20+
-- search_appearances table
21+
create index search_appearances_job_id_idx on search_appearances (job_id);
22+
create index search_appearances_day_idx on search_appearances (day);
23+
create index search_appearances_job_id_day_idx on search_appearances (job_id, day);
24+
25+
-- employer_team table
26+
create index employer_team_approved_idx on employer_team (approved) where approved = false;
27+
create index employer_team_user_id_approved_idx on employer_team (user_id, approved);
28+
29+
-- application table
30+
create index application_created_at_idx on application (created_at);
31+
32+
-- session table
33+
create index session_expires_at_idx on session (expires_at);
34+
35+
-- user table
36+
create index user_email_verified_idx on "user" (email_verified) where email_verified = false;
37+
38+
---- create above / drop below ----
39+
40+
drop index if exists user_email_verified_idx;
41+
drop index if exists session_expires_at_idx;
42+
drop index if exists application_created_at_idx;
43+
drop index if exists employer_team_user_id_approved_idx;
44+
drop index if exists employer_team_approved_idx;
45+
drop index if exists search_appearances_job_id_day_idx;
46+
drop index if exists search_appearances_day_idx;
47+
drop index if exists search_appearances_job_id_idx;
48+
drop index if exists job_views_job_id_day_idx;
49+
drop index if exists job_views_day_idx;
50+
drop index if exists job_views_job_id_idx;
51+
drop index if exists job_seniority_idx;
52+
drop index if exists job_upstream_commitment_idx;
53+
drop index if exists job_open_source_idx;
54+
drop index if exists job_salary_max_usd_year_idx;
55+
drop index if exists job_first_published_at_idx;
56+
drop index if exists job_created_at_idx;
57+
drop index if exists job_published_at_desc_idx;
58+
drop index if exists job_published_at_idx;
59+
drop index if exists job_project_project_id_idx;
60+
drop index if exists job_project_job_id_idx;

0 commit comments

Comments
 (0)