Hi,
We are having the java batch job, it will receive the around 250000 records and upload into the mysql database.
table TB10_MESSAGE having aroung 1 crore record and TB60_TMP_MESSAGE_UPLOAD having 250000 records.
Below query executing aroung 6 hours ,
UPDATE TB10_MESSAGE SET TP_PREVIOUS_ACTIVATE_STATUS_DATE = TP_ACTIVATE_STATUS_DATE, TP_PREVIOUS_ACTIVATE_STATUS = TP_ACTIVE_STATUS,TP_ACTIVE_STATUS = 'S', TP_ACTIVATE_STATUS_DATE = NOW(), TP_LAST_REMOVE_DATE = NOW(), TP_QUANTITY = 0 where concat(TP_TAG_GROUPING_ID,TP_GP_NUMBER,TP_PART_NUM BER,TP_PIB_TYPE) NOT IN(select concat(TMP_TAG_GROUPING_ID,TMP_TP_GP_NUMBER,TMP_TP _PART_NUMBER,TMP_TP_PIB_TYPE) from TB60_TMP_MESSAGE_UPLOAD where TMP_TP_DEL IS NULL ) AND TP_PART_NUMBER is not null AND TP_ACTIVE_STATUS != 'S';
But we would to optimize the query. Please help me!
I trying to modify above query as below,
UPDATE TB10_MESSAGE as M
LEFT JOIN TB60_TMP_MESSAGE_UPLOAD as T
ON CONCAT(M.TP_TAG_GROUPING_ID,M.TP_GP_NUMBER,M.TP_PA RT_NUMBER,M.TP_PIB_TYPE)=concat(T.TMP_TAG_GROUPING _ID,T.TMP_TP_GP_NUMBER,T.TMP_TP_PART_NUMBER,T.TMP_ TP_PIB_TYPE)
SET TP_PREVIOUS_ACTIVATE_STATUS_DATE = TP_ACTIVATE_STATUS_DATE, TP_PREVIOUS_ACTIVATE_STATUS = TP_ACTIVE_STATUS,TP_ACTIVE_STATUS = 'S', TP_ACTIVATE_STATUS_DATE = NOW(), TP_LAST_REMOVE_DATE = NOW(), TP_QUANTITY = 0
WHERE concat(T.TMP_TAG_GROUPING_ID,T.TMP_TP_GP_NUMBER,T. TMP_TP_PART_NUMBER,T.TMP_TP_PIB_TYPE) IS NULL
AND TP_PART_NUMBER IS NOT NULL
AND TMP_TP_DEL IS NULL
AND TP_ACTIVE_STATUS != 'S';
Please help me for it!