Add composite indexes

This commit is contained in:
Jan Eitzinger 2023-06-01 15:40:37 +02:00
parent 203ccdf73b
commit 2de85b0120
4 changed files with 17 additions and 5 deletions

View File

@ -2,4 +2,7 @@ DROP INDEX IF EXISTS job_stats;
DROP INDEX IF EXISTS job_by_user; DROP INDEX IF EXISTS job_by_user;
DROP INDEX IF EXISTS job_by_starttime; DROP INDEX IF EXISTS job_by_starttime;
DROP INDEX IF EXISTS job_by_job_id; DROP INDEX IF EXISTS job_by_job_id;
DROP INDEX IF EXISTS job_by_state; DROP INDEX IF EXISTS job_list;
DROP INDEX IF EXISTS job_list_user;
DROP INDEX IF EXISTS job_list_users;
DROP INDEX IF EXISTS job_list_users_start;

View File

@ -2,4 +2,7 @@ CREATE INDEX IF NOT EXISTS job_stats ON job (cluster,subcluster,user);
CREATE INDEX IF NOT EXISTS job_by_user ON job (user); CREATE INDEX IF NOT EXISTS job_by_user ON job (user);
CREATE INDEX IF NOT EXISTS job_by_starttime ON job (start_time); CREATE INDEX IF NOT EXISTS job_by_starttime ON job (start_time);
CREATE INDEX IF NOT EXISTS job_by_job_id ON job (job_id); CREATE INDEX IF NOT EXISTS job_by_job_id ON job (job_id);
CREATE INDEX IF NOT EXISTS job_by_state ON job (job_state); CREATE INDEX IF NOT EXISTS job_list ON job (cluster, job_state);
CREATE INDEX IF NOT EXISTS job_list_user ON job (user, cluster, job_state);
CREATE INDEX IF NOT EXISTS job_list_users ON job (user, job_state);
CREATE INDEX IF NOT EXISTS job_list_users_start ON job (start_time, user, job_state);

View File

@ -2,4 +2,7 @@ DROP INDEX IF EXISTS job_stats;
DROP INDEX IF EXISTS job_by_user; DROP INDEX IF EXISTS job_by_user;
DROP INDEX IF EXISTS job_by_starttime; DROP INDEX IF EXISTS job_by_starttime;
DROP INDEX IF EXISTS job_by_job_id; DROP INDEX IF EXISTS job_by_job_id;
DROP INDEX IF EXISTS job_by_state; DROP INDEX IF EXISTS job_list;
DROP INDEX IF EXISTS job_list_user;
DROP INDEX IF EXISTS job_list_users;
DROP INDEX IF EXISTS job_list_users_start;

View File

@ -1,5 +1,8 @@
CREATE INDEX IF NOT EXISTS job_stats ON job (cluster,subcluster,user); CREATE INDEX IF NOT EXISTS job_stats ON job (cluster,subcluster,user);
CREATE INDEX IF NOT EXISTS job_by_user ON job (user); CREATE INDEX IF NOT EXISTS job_by_user ON job (user);
CREATE INDEX IF NOT EXISTS job_by_starttime ON job (start_time); CREATE INDEX IF NOT EXISTS job_by_starttime ON job (start_time);
CREATE INDEX IF NOT EXISTS job_by_job_id ON job (job_id); CREATE INDEX IF NOT EXISTS job_by_job_id ON job (job_id, cluster, start_time);
CREATE INDEX IF NOT EXISTS job_by_state ON job (job_state); CREATE INDEX IF NOT EXISTS job_list ON job (cluster, job_state);
CREATE INDEX IF NOT EXISTS job_list_user ON job (user, cluster, job_state);
CREATE INDEX IF NOT EXISTS job_list_users ON job (user, job_state);
CREATE INDEX IF NOT EXISTS job_list_users_start ON job (start_time, user, job_state);