flowable 国产数据库并发性能优化
最近在生产环境有用户反馈系统流转速度较慢,这边用的是金仓数据库,这边查了数据库的慢sql日志,最后发现问题,以下是部分慢sql的执行时间截图
主要都是流转过程中更新执行表和历史变量表执行时间较长,于是查了表的默认索引,发现并没有针对以上涉及到的字段添加索引,导致并发下执行时间较长,于是根据生产环境慢sql日志整理如下更新索引:
CREATE INDEX "act_ru_varia_exe_name_taskid" ON "PUBLIC"."ACT_RU_VARIABLE" USING BTREE (EXECUTION_ID_,NAME_,TASK_ID_);
CREATE INDEX "act_ru_execution_id_rev" ON "PUBLIC"."ACT_RU_EXECUTION" USING BTREE (ID_,REV_);
CREATE INDEX "act_ru_execution_parentid" ON "PUBLIC"."ACT_RU_EXECUTION" USING BTREE (PARENT_ID_);
CREATE INDEX "act_ru_varia_exeid_taskid" ON "PUBLIC"."ACT_RU_VARIABLE" USING BTREE (EXECUTION_ID_,TASK_ID_);
CREATE INDEX "ACT_HI_VARINST_id_rev" ON "PUBLIC"."ACT_HI_VARINST" USING BTREE (ID_,REV_);
CREATE INDEX "ACT_HI_VARINST_id" ON "PUBLIC"."ACT_HI_VARINST" USING BTREE (ID_);
CREATE INDEX "act_hi_varinst_id_rev" ON "PUBLIC"."ACT_HI_VARINST" USING BTREE (ID_,REV_);
CREATE INDEX "ACT_RU_HISTORY_JOB_id_rev" ON "PUBLIC"."ACT_RU_HISTORY_JOB" USING BTREE (ID_,REV_);
CREATE INDEX "ACT_RU_VARIABLE_id_revs" ON "PUBLIC"."ACT_RU_VARIABLE" USING BTREE (ID_,REV_);
CREATE INDEX "ACT_RU_VARIABLE_id_rev" ON "PUBLIC"."ACT_RU_VARIABLE" USING BTREE (EXECUTION_ID_,TASK_ID_);
CREATE INDEX "ACT_RU_VARIABLE_id_name_rev" ON "PUBLIC"."ACT_RU_VARIABLE" USING BTREE (EXECUTION_ID_,NAME_,TASK_ID_);
增加索引后,流转效率有明显提升。