DROP INDEX IF EXISTS addressid ON crm_actionaddresslinks;
CREATE INDEX IF NOT EXISTS dlb_perf_2 ON crm_actionaddresslinks (addressid, crmactionid);

DROP INDEX IF EXISTS subtype ON crm_actions;
DROP INDEX IF EXISTS globalaclgrp ON crm_actions;
CREATE INDEX IF NOT EXISTS dlb_perf_3 ON crm_actions (subtype, ownerid, groupguid);
CREATE INDEX IF NOT EXISTS dlb_perf_3_acl ON crm_actions (globalaclgrp, subtype, ownerid, groupguid);

DROP INDEX IF EXISTS addressid ON crm_remembersettings;
CREATE INDEX IF NOT EXISTS dlb_covering_1 ON crm_remembersettings (addressid, aidentifier, rmdaysbefore, warnmode);

DROP INDEX IF EXISTS responsiblepersonid ON crm_actiontasks;
CREATE INDEX IF NOT EXISTS dlb_perf_5 ON crm_actiontasks (responsiblepersonid, reponsibleteamid, remembertype, duedate, finishdate);

DROP INDEX IF EXISTS ownerid ON sched_reminders;
CREATE INDEX IF NOT EXISTS dlb_perf_4 ON sched_reminders (ownerid, reminderdate);

CREATE INDEX IF NOT EXISTS dlb_perf_6 ON crm_tracking (expiredate, trackstate);

DROP INDEX IF EXISTS creaid ON crm_actions;
CREATE INDEX IF NOT EXISTS dlb_perf_7 ON crm_actions (creaid, sendtime, sentstateid, comproviderident, globalaclgrp);

DROP INDEX IF EXISTS ownerid ON crm_actions;
CREATE INDEX IF NOT EXISTS dlb_perf_8 ON crm_actions (ownerid, eventid);