--流程状态
CREATE INDEX IDX_BPMPROSTATUS_ACTINSTID ON BPM_PRO_STATUS (ACTINSTID);
CREATE INDEX IDX_BPMPROSTATUS_INSTNODEID ON BPM_PRO_STATUS (ACTINSTID,NODEID);
--流程意见
CREATE INDEX IDX_TASKOPTION_INSTANCE_USER ON BPM_TASK_OPINION (actInstId,EXEUSERID);
CREATE INDEX IDX_TASKOPTION_INSTANCE_TASK ON BPM_TASK_OPINION (actInstId,taskKey);
--流程堆栈
CREATE INDEX IDX_BPMSTACKINST_depth ON BPM_EXE_STACK (actInstId,depth);
CREATE INDEX IDX_BPMSTACK_PARENTID ON BPM_EXE_STACK (parentId);
--表单运行时
CREATE INDEX IDX_BPMFORMRUN_INSTANCEID ON BPM_FORM_RUN (ACTINSTANCEID);
CREATE INDEX IDX_BPMFORMRUN_INSTANCENODEID ON BPM_FORM_RUN (ACTINSTANCEID,ACTNODEID);
--会签数据
CREATE INDEX IDX_BPMTKSIGNDATA_ACTDEFNODEID ON BPM_TKSIGN_DATA  (ACTINSTID,NODEID);
CREATE INDEX IDX_BPMTKSIGNDATA_TASKID ON BPM_TKSIGN_DATA  (TASKID);
--催办任务状态
CREATE INDEX IDX_REMINDERSTATE_TASKUSERID ON BPM_TASK_REMINDERSTATE (TASKID,USERID);
CREATE INDEX IDX_REMINDERSTATE_TASKID ON BPM_TASK_REMINDERSTATE (TASKID);
--流程实例扩展
CREATE INDEX IDX_PRORUN_INSTANCEID ON BPM_PRO_RUN (ACTINSTID);
CREATE INDEX IDX_PROCESSRUN_CREATORID ON BPM_PRO_RUN (CREATORID);
--流程实例扩展历史
CREATE INDEX IDX_PRORUN_HIS_INSTANCEID ON BPM_PRO_RUN_HIS (ACTINSTID);
CREATE INDEX IDX_PROCESSRUN_HIS_CREATORID ON BPM_PRO_RUN_HIS (CREATORID);
--流程运行日志
CREATE INDEX IDX_RUNLOG_USERID ON BPM_RUN_LOG (USERID);
CREATE INDEX IDX_RUNLOG_RUNID ON BPM_RUN_LOG (RUNID);
--任务交办 BPM_TASK_ASSIGNEE已删除
--CREATE INDEX IDX_TASKASSIGNEE_USERID ON BPM_TASK_ASSIGNEE (USER_ID);
--CREATE INDEX IDX_TASKASSIGNEE_ASSIGNEE ON BPM_TASK_ASSIGNEE (ASSIGNEE_ID);
--邮件设定
CREATE INDEX IDX_MAILUSERSETTING ON OUT_MAIL_USER_SETING (USERID);
--邮件联系人
CREATE INDEX IDX_MAILLINKMAN ON OUT_MAIL_LINKMAN (USERID);
--邮件
CREATE INDEX IDX_OUTMAIL_USERID ON OUT_MAIL (USERID);
--发送消息（已存在）
--CREATE INDEX IDX_MSGSEND_USERID ON SYS_MSG_SEND (USERID);
--消息接收人
CREATE INDEX IDX_MSGRECEIVER_MESSAGEID ON SYS_MSG_RECEIVER (MESSAGEID);
CREATE INDEX IDX_MSGRECEIVER_RECEIVERID ON SYS_MSG_RECEIVER (RECEIVERID);
--消息读取
CREATE INDEX IDX_MSGREAD_RECEIVERID ON SYS_MSG_READ (RECEIVERID);
CREATE INDEX IDX_MSGREAD_MESSAGEID ON SYS_MSG_READ (MESSAGEID);
--消息回复
CREATE INDEX IDX_MSG_REPLY_MESSAGEID ON SYS_MSG_REPLY (MESSAGEID);
CREATE INDEX IDX_MSG_REPLY_REPLYID ON SYS_MSG_REPLY (REPLYID);

--角色和资源的映射
CREATE INDEX IDX_ROLERES_RESID ON SYS_ROLE_RES (RESID);
CREATE INDEX IDX_ROLERES_ROLEID ON SYS_ROLE_RES (ROLEID);
--资源
CREATE INDEX IDX_SYSRES_SYSTEMID ON SYS_RES  (SYSTEMID);
CREATE INDEX IDX_SYSRES_PARENTID ON SYS_RES  (PARENTID);
CREATE INDEX IDX_RESURL_RESID ON SYS_RESURL  (RESID);
--流程代理 SYS_USER_AGENT已删除
--CREATE INDEX IDX_USERAGENT_AGENTUSERID ON SYS_USER_AGENT  (AGENTUSERID);
--CREATE INDEX IDX_USERAGENT_TOUSERID ON SYS_USER_AGENT  (TOUSERID);
--用户参数
CREATE INDEX IDX_USERPARAM_USERID ON SYS_USER_PARAM  (USERID);
CREATE INDEX IDX_USERPARAM_PARAMID ON SYS_USER_PARAM  (PARAMID);
--下属
CREATE INDEX IDX_USERUNDER_USERID ON SYS_USER_UNDER  (USERID);
CREATE INDEX IDX_USERUNDER_UNDERUSERID ON SYS_USER_UNDER  (UNDERUSERID);
--组织和角色的映射
CREATE INDEX IDX_ORGROLE_ORGID ON SYS_ORG_ROLE  (ORGID);
CREATE INDEX IDX_ORGROLE_ROLE ON SYS_ORG_ROLE  (ROLEID);
--表单字段
CREATE INDEX IDX_FORMFIELD_TABLEID ON BPM_FORM_FIELD  (TABLEID);
--组织可授权角色
CREATE INDEX IDX_ORGROLEMANAGE_ORGID ON SYS_ORG_ROLEMANAGE  (ORGID);
CREATE INDEX IDX_ORGROLEMANAGE_ROLEID ON SYS_ORG_ROLEMANAGE  (ROLEID);
--表单权限
CREATE INDEX IDX_FORMRIGHTS_FORMDEFID ON BPM_FORM_RIGHTS  (FORMKEY);

CREATE UNIQUE INDEX IDX_SYS_POS_CODE ON SYS_POS(POSCODE);

CREATE UNIQUE INDEX IDX_SYS_JOB_CODE ON SYS_JOB(JOBCODE);

CREATE UNIQUE INDEX IDX_SYS_PARAM_KEY ON SYS_PARAM(PARAMKEY);

CREATE INDEX  NODEID_FLOWKEY_INDEX ON  BPM_NEWFLOW_TRIGGER (FLOWKEY, NODEID);

go

CREATE INDEX IDX_VIEW_ALIAS ON SYS_QUERY_VIEW (  SQL_ALIAS ASC,    ALIAS ASC);
CREATE INDEX IDX_METAFIELD_SQLID ON SYS_QUERY_METAFIELD (   SQL_ID ASC);
CREATE INDEX IDX_FIELDSETTING_VIEWID ON SYS_QUERY_FIELDSETTING (   VIEW_ID ASC);

CREATE INDEX ID_HISTORYDATA_OBJID ON SYS_HISTORY_DATA (OBJ_ID ASC);

CREATE INDEX GROUPID_INDEX ON SYS_READ_RECORD (GROUPID ASC);
CREATE INDEX OBJECTID_INDEX ON SYS_READ_RECORD (OBJECTID ASC);
CREATE UNIQUE INDEX  OBJECTID_USER_INDEX ON SYS_READ_RECORD (OBJECTID ASC, USERID ASC);

CREATE UNIQUE INDEX  WEIXINID_UNIQUE_INDEX ON SYS_USER (WEIXINID ASC);
CREATE INDEX MOBILEFORM_KEY ON BPM_MOBILE_FORM_DEF (
FORM_KEY ASC);

go