CREATE INDEX IF NOT EXISTS ix_mined_uri_anno_id on mined_chum_uri_table (event_type_name, annotation_task_id, chum_uri, deleted);

CREATE INDEX IF NOT EXISTS ix_event_task_id_chum_uri ON event_table (task_id, chum_uri_path);
CREATE INDEX IF NOT EXISTS ix_event_state_id_task_id_id ON event_table (state_id, task_id, id);
CREATE INDEX IF NOT EXISTS ix_event_task_id_run_id_id ON event_table (task_id, run_id, id);
CREATE INDEX IF NOT EXISTS ix_event_task_id_timestamp_id ON event_table (task_id, start_ts, id);
CREATE INDEX IF NOT EXISTS ix_event_task_id_created_at ON event_table (task_id, created_at);
CREATE INDEX IF NOT EXISTS ix_event_task_priority_desc_id_state_deleted_rater_ds_manager ON event_table (task_id, priority DESC, id, state_id, deleted, last_assigned_rater, last_answered_ds, last_assigned_manager);
CREATE INDEX IF NOT EXISTS ix_event_task_state_deleted_rater_ds_manager ON event_table (task_id, state_id, deleted, last_assigned_rater, last_answered_ds, last_assigned_manager);


CREATE INDEX IF NOT EXISTS ix_event_job_id ON event_table (mining_job_id);
CREATE INDEX IF NOT EXISTS ix_event_event_type_chum_uri ON event_table (event_type_id, chum_uri_path);
CREATE INDEX IF NOT EXISTS ix_event_mining_task_chum_uri ON event_table (mining_task_id, chum_uri_path);

CREATE INDEX IF NOT EXISTS ix_qna_job_id ON qna_table (mining_job_id);
CREATE INDEX IF NOT EXISTS ix_qna_event_type_chum_uri ON qna_table (event_type_id, chum_uri_path);
CREATE INDEX IF NOT EXISTS ix_qna_mining_task_chum_uri ON qna_table (mining_task_id, chum_uri_path);
