2002-04-30 22:22:54 +00:00
|
|
|
|
|
|
|
alter table platform
|
|
|
|
add unique(name);
|
|
|
|
|
|
|
|
alter table app
|
|
|
|
add unique(name);
|
|
|
|
|
|
|
|
alter table app_version
|
2008-03-13 22:57:24 +00:00
|
|
|
add unique apvp (appid, platformid, version_num, plan_class);
|
2002-04-30 22:22:54 +00:00
|
|
|
|
|
|
|
alter table user
|
2003-01-03 22:17:40 +00:00
|
|
|
add unique(email_addr),
|
|
|
|
add unique(authenticator),
|
|
|
|
add index ind_tid (teamid),
|
2004-06-16 19:10:24 +00:00
|
|
|
add index user_name(name),
|
2003-01-31 07:19:20 +00:00
|
|
|
add index user_tot (total_credit desc),
|
2003-12-02 22:04:26 +00:00
|
|
|
-- db_dump.C
|
2018-05-10 14:34:39 +00:00
|
|
|
add index user_avg (expavg_credit desc),
|
2003-12-02 22:04:26 +00:00
|
|
|
-- db_dump.C
|
2018-05-10 14:34:39 +00:00
|
|
|
add index user_email_time (email_addr_change_time);
|
2002-04-30 22:22:54 +00:00
|
|
|
|
2002-07-11 20:35:05 +00:00
|
|
|
alter table team
|
2003-01-31 00:04:51 +00:00
|
|
|
add unique(name),
|
2007-10-26 21:14:35 +00:00
|
|
|
add fulltext index team_name_desc(name, description),
|
2003-01-31 07:19:20 +00:00
|
|
|
add index team_avg (expavg_credit desc),
|
2003-12-02 22:04:26 +00:00
|
|
|
-- db_dump.C
|
2006-10-27 16:06:42 +00:00
|
|
|
add index team_tot (total_credit desc),
|
2003-12-02 22:04:26 +00:00
|
|
|
-- db_dump.C
|
2006-10-27 16:06:42 +00:00
|
|
|
add index team_userid (userid);
|
2002-07-11 20:35:05 +00:00
|
|
|
|
2002-04-30 22:22:54 +00:00
|
|
|
alter table workunit
|
2003-01-03 22:17:40 +00:00
|
|
|
add unique(name),
|
2003-12-02 22:04:26 +00:00
|
|
|
-- not currently used but good invariant
|
2003-01-03 22:17:40 +00:00
|
|
|
add index wu_val (appid, need_validate),
|
2003-12-02 22:04:26 +00:00
|
|
|
-- validator
|
2003-08-15 20:35:44 +00:00
|
|
|
add index wu_timeout (transition_time),
|
2003-12-02 22:04:26 +00:00
|
|
|
-- transitioner
|
2005-01-07 19:45:46 +00:00
|
|
|
add index wu_filedel (file_delete_state),
|
2004-12-27 21:14:18 +00:00
|
|
|
-- file_deleter, db_purge
|
2003-01-03 22:17:40 +00:00
|
|
|
add index wu_assim (appid, assimilate_state);
|
2003-12-02 22:04:26 +00:00
|
|
|
-- assimilator
|
2002-04-30 22:22:54 +00:00
|
|
|
|
|
|
|
alter table result
|
2003-01-03 22:17:40 +00:00
|
|
|
add unique(name),
|
2003-12-02 22:04:26 +00:00
|
|
|
-- the scheduler looks up results by name
|
|
|
|
|
2003-12-31 23:09:21 +00:00
|
|
|
add index res_wuid (workunitid),
|
|
|
|
-- transitioner
|
|
|
|
-- NOTE res_wu_user may suffice, could try dropping this one
|
2003-12-02 22:04:26 +00:00
|
|
|
|
2004-12-06 22:41:19 +00:00
|
|
|
add index ind_res_st (server_state, priority),
|
2004-07-08 19:20:19 +00:00
|
|
|
-- feeder
|
2003-12-02 22:04:26 +00:00
|
|
|
|
|
|
|
add index res_app_state(appid, server_state),
|
2007-07-09 20:09:49 +00:00
|
|
|
-- to get count of unsent results for given app (e.g. in work generator)
|
2003-12-02 22:04:26 +00:00
|
|
|
|
2003-08-15 17:36:44 +00:00
|
|
|
add index res_filedel (file_delete_state),
|
2003-12-02 22:04:26 +00:00
|
|
|
-- file_deleter
|
|
|
|
|
|
|
|
add index res_userid_id(userid, id desc),
|
|
|
|
-- html_user/results.php
|
|
|
|
|
|
|
|
add index res_userid_val(userid, validate_state),
|
|
|
|
-- to show pending credit
|
|
|
|
|
2003-12-09 06:46:50 +00:00
|
|
|
add index res_hostid_id (hostid, id desc),
|
2003-12-02 22:04:26 +00:00
|
|
|
-- html_user/results.php
|
|
|
|
|
2005-01-12 21:16:45 +00:00
|
|
|
add index res_wu_user (workunitid, userid);
|
2003-12-02 22:04:26 +00:00
|
|
|
-- scheduler (avoid sending mult results of same WU to one user)
|
|
|
|
|
2004-06-24 21:00:46 +00:00
|
|
|
alter table msg_from_host
|
2018-05-16 20:38:34 +00:00
|
|
|
add index message_handled (handled),
|
2004-06-24 21:00:46 +00:00
|
|
|
-- for message handler
|
2018-05-17 13:46:37 +00:00
|
|
|
add index message_hostid(hostid);
|
2018-05-16 20:38:34 +00:00
|
|
|
-- for delete account
|
2004-03-17 01:26:44 +00:00
|
|
|
|
2004-06-24 21:00:46 +00:00
|
|
|
alter table msg_to_host
|
|
|
|
add index msg_to_host(hostid, handled);
|
2004-03-17 01:26:44 +00:00
|
|
|
-- for scheduler
|
2004-01-04 06:48:40 +00:00
|
|
|
|
2003-01-03 22:17:40 +00:00
|
|
|
alter table host
|
2018-09-07 15:10:03 +00:00
|
|
|
add index host_userid_cpid (userid, host_cpid),
|
2003-12-02 22:04:26 +00:00
|
|
|
-- html_user/host_user.php
|
2018-09-07 15:10:03 +00:00
|
|
|
-- sched/handle_request.cpp for user with many hosts
|
2018-08-23 20:10:48 +00:00
|
|
|
add index host_domain_name (domain_name),
|
2018-09-07 15:10:03 +00:00
|
|
|
-- sched/handle_request.cpp for user with many hosts
|
2003-01-31 07:19:20 +00:00
|
|
|
add index host_avg (expavg_credit desc),
|
2003-12-02 22:04:26 +00:00
|
|
|
-- db_dump.C
|
2003-01-31 07:19:20 +00:00
|
|
|
add index host_tot (total_credit desc);
|
2003-12-02 22:04:26 +00:00
|
|
|
-- db_dump.C
|
2003-10-24 20:13:50 +00:00
|
|
|
|
|
|
|
alter table profile
|
2003-12-31 23:09:21 +00:00
|
|
|
add fulltext index profile_reponse(response1, response2),
|
2004-06-01 17:02:14 +00:00
|
|
|
add index pro_uotd (uotd_time desc),
|
2003-10-24 20:13:50 +00:00
|
|
|
add unique profile_userid(userid);
|
2003-12-02 22:04:26 +00:00
|
|
|
|
|
|
|
alter table subscriptions
|
|
|
|
add unique sub_unique(userid, threadid);
|
2003-12-09 06:46:50 +00:00
|
|
|
|
2004-02-17 02:16:53 +00:00
|
|
|
alter table category
|
|
|
|
add unique cat1(name, is_helpdesk);
|
|
|
|
|
|
|
|
alter table forum
|
2007-11-14 21:55:05 +00:00
|
|
|
add unique pct (parent_type, category, title);
|
2004-02-17 02:16:53 +00:00
|
|
|
|
2003-12-09 06:46:50 +00:00
|
|
|
alter table thread
|
|
|
|
add fulltext index thread_title(title);
|
|
|
|
|
|
|
|
alter table post
|
2003-12-21 05:55:48 +00:00
|
|
|
add index post_user (user),
|
|
|
|
add index post_thread (thread),
|
2003-12-09 06:46:50 +00:00
|
|
|
add fulltext index post_content(content);
|
2007-05-02 18:51:51 +00:00
|
|
|
|
2007-05-02 23:17:52 +00:00
|
|
|
alter table credited_job
|
2007-07-27 18:30:10 +00:00
|
|
|
add index credited_job_user (userid),
|
|
|
|
add index credited_job_wu (workunitid),
|
|
|
|
add unique credited_job_user_wu (userid, workunitid);
|
|
|
|
|
|
|
|
alter table team_delta
|
2018-05-16 20:38:34 +00:00
|
|
|
add index team_delta_teamid (teamid, timestamp),
|
|
|
|
add index team_delta_userid (userid);
|
|
|
|
-- for delete account
|
2007-11-03 04:26:47 +00:00
|
|
|
|
|
|
|
alter table team_admin
|
|
|
|
add unique (teamid, userid);
|
2007-12-18 20:28:08 +00:00
|
|
|
|
|
|
|
alter table friend
|
|
|
|
add unique friend_u (user_src, user_dest);
|
|
|
|
|
|
|
|
alter table notify
|
2007-12-30 22:02:16 +00:00
|
|
|
add unique notify_un (userid, type, opaque);
|
2010-03-29 22:28:20 +00:00
|
|
|
|
|
|
|
alter table host_app_version
|
|
|
|
add unique hap(host_id, app_version_id);
|
2012-01-30 22:39:13 +00:00
|
|
|
|
|
|
|
alter table assignment
|
|
|
|
add index asgn_target(target_type, target_id);
|
2012-11-26 03:12:08 +00:00
|
|
|
|
|
|
|
alter table job_file
|
2017-03-06 19:35:00 +00:00
|
|
|
add unique jf_name(name);
|
2013-12-05 18:14:26 +00:00
|
|
|
|
|
|
|
alter table badge_user
|
|
|
|
add unique (user_id, badge_id);
|
|
|
|
|
|
|
|
alter table badge_team
|
2013-12-23 04:53:10 +00:00
|
|
|
add unique (team_id, badge_id);
|
2017-03-17 18:45:45 +00:00
|
|
|
|
|
|
|
alter table credit_user
|
|
|
|
add index cu_total(appid, total),
|
|
|
|
add index cu_avg(appid, expavg);
|
|
|
|
|
|
|
|
alter table credit_team
|
|
|
|
add index ct_total(appid, total),
|
|
|
|
add index ct_avg(appid, expavg);
|
2018-05-16 20:38:34 +00:00
|
|
|
|
|
|
|
alter table token
|
|
|
|
add index token_userid(userid);
|
|
|
|
|
|
|
|
alter table user_deleted
|
2018-05-17 13:46:37 +00:00
|
|
|
add index user_deleted_create(create_time);
|
2018-05-16 20:38:34 +00:00
|
|
|
-- for delete account
|
|
|
|
|
|
|
|
alter table host_deleted
|
2018-05-17 13:46:37 +00:00
|
|
|
add index host_deleted_create(create_time);
|
2018-05-16 20:38:34 +00:00
|
|
|
-- for delete account
|
|
|
|
|
|
|
|
alter table donation_paypal
|
|
|
|
-- for delete account
|
2018-05-17 13:46:37 +00:00
|
|
|
add index donation_paypal_userid(userid);
|
2018-05-16 20:38:34 +00:00
|
|
|
|
|
|
|
alter table banishment_vote
|
2018-05-17 13:46:37 +00:00
|
|
|
add index banishment_vote_userid(userid);
|
2018-05-16 20:38:34 +00:00
|
|
|
-- for delete account
|
|
|
|
|
|
|
|
alter table post_ratings
|
2018-05-17 13:46:37 +00:00
|
|
|
add index post_ratings_user(user);
|
2018-05-16 20:38:34 +00:00
|
|
|
-- for delete account
|
|
|
|
|
|
|
|
alter table sent_email
|
2018-05-17 13:46:37 +00:00
|
|
|
add index sent_email_userid(userid);
|
2018-05-16 20:38:34 +00:00
|
|
|
-- for delete account
|
2018-06-12 17:08:26 +00:00
|
|
|
|
2018-09-11 13:32:02 +00:00
|
|
|
alter table private_messages
|
|
|
|
add index userid(userid);
|
|
|
|
|
2018-06-12 17:08:26 +00:00
|
|
|
alter table consent
|
2018-09-13 15:08:05 +00:00
|
|
|
add index userid_ctid_timestamp(userid, consent_type_id, consent_time),
|
2018-09-12 20:43:13 +00:00
|
|
|
add index consent_timestamp(consent_time),
|
2018-09-12 16:32:40 +00:00
|
|
|
add index flag_ctid(consent_flag, consent_type_id);
|
|
|
|
|
|
|
|
alter table consent
|
|
|
|
add foreign key(consent_type_id)
|
|
|
|
references consent_type(id)
|
2018-10-25 15:19:43 +00:00
|
|
|
on update cascade
|
|
|
|
on delete restrict;
|
|
|
|
-- explicit delete restrict on this foreign key
|
2018-06-12 17:08:26 +00:00
|
|
|
|
|
|
|
alter table consent_type
|
|
|
|
add index consent_name(shortname);
|