colosa/processmaker — pull request #604 by julceslauhub (2012-09-25 21:10:14+00:00)
Title:  Performance improvement in the reassign

- Improvement for the query:

SELECT APPLICATION.APP_UID, APPLICATION.APP_NUMBER, APPLICATION.APP_UPDATE_DATE, APP_DELEGATION.DEL_PRIORITY, APP_DELEGATION.DEL_INDEX, APP_DELEGATION.TAS_UID, APP_DELEGATION.DEL_INIT_DATE, APP_DELEGATION.DEL_FINISH_DATE, USERS.USR_UID, APPLICATION.APP_STATUS, IF (APP_DELEGATION.DEL_TASK_DUE_DATE <= NOW(), APP_DELEGATION.DEL_TASK_DUE_DATE , APP_DELEGATION.DEL_TASK_DUE_DATE) AS DEL_TASK_DUE_DATE, CONCAT(USERS.USR_LASTNAME, '?', USERS.USR_FIRSTNAME) AS APP_CURRENT_USER, APP_TITLE.CON_VALUE AS APP_TITLE, PRO_TITLE.CON_VALUE AS APP_PRO_TITLE, TAS_TITLE.CON_VALUE AS APP_TAS_TITLE, CONCAT(APP_LAST_USER.USR_LASTNAME, '?', APP_LAST_USER.USR_FIRSTNAME) AS APP_DEL_PREVIOUS_USER FROM APPLICATION LEFT JOIN APP_DELEGATION ON (APPLICATION.APP_UID=APP_DELEGATION.APP_UID) LEFT JOIN TASK ON (APP_DELEGATION.TAS_UID=TASK.TAS_UID) LEFT JOIN USERS ON (APP_DELEGATION.USR_UID=USERS.USR_UID) LEFT JOIN APP_THREAD ON (APPLICATION.APP_UID=APP_THREAD.APP_UID AND APP_DELEGATION.DEL_INDEX=APP_THREAD.DEL_INDEX) LEFT JOIN CONTENT APP_TITLE ON (APPLICATION.APP_UID=APP_TITLE.CON_ID AND APP_TITLE.CON_CATEGORY='?' AND APP_TITLE.CON_LANG='?') LEFT JOIN CONTENT PRO_TITLE ON (APPLICATION.PRO_UID=PRO_TITLE.CON_ID AND PRO_TITLE.CON_CATEGORY='?' AND PRO_TITLE.CON_LANG='?') LEFT JOIN CONTENT TAS_TITLE ON (APP_DELEGATION.TAS_UID=TAS_TITLE.CON_ID AND TAS_TITLE.CON_CATEGORY='?' AND TAS_TITLE.CON_LANG='?') LEFT JOIN APP_DELEGATION APP_PREV_DEL ON (APPLICATION.APP_UID=APP_PREV_DEL.APP_UID AND APP_PREV_DEL.DEL_INDEX=APP_DELEGATION.DEL_PREVIOUS) LEFT JOIN USERS APP_LAST_USER ON (APP_PREV_DEL.USR_UID=APP_LAST_USER.USR_UID) WHERE TASK.TAS_TYPE<>'?' AND APP_DELEGATION.DEL_FINISH_DATE IS NULL AND APP_THREAD.APP_THREAD_STATUS='?' AND APP_DELEGATION.DEL_THREAD_STATUS='?' AND APPLICATION.APP_UID='?'