[英]Update query inside the Batch update execution is taking long time
System.out.println("multipleBatchUpdateCheckErroreValues.update starting time------"+ new DateTime());
multipleBatchUpdateCheckError(
vSql.toString(), //sql query
pPriceMap.toList(), //rows
50, //batch size
new ObjectPreparedStatementSetter() {
public void setValues(Object row, PreparedStatement ps, int rowNo) throws SQLException {
Price vPrice = (Price) row;
prepareValues(vPrice, ps, UPDATE);
}
});
}
System.out.println("multipleBatchUpdateCheckErroreValues.update ending time------"
+ new DateTime());
In the above code, Update is taking too much time to finish.在上面的代码中,更新花费了太多时间来完成。 How to optimize the below code execution time?如何优化以下代码执行时间?
SQL Query is SQL 查询是
UPDATE PRICE_T
SET TO_TIME = ?,
PRICE_EXCLUDING_TAX = ?,
PRICE_INCLUDING_TAX = ?,
REASON = ?,
PRIORITY_TYPE = ?,
TRANS_TIME = ?,
DEL_TIME = ?,
UPD_TIME = ?
WHERE CLASS = ?
and CLASS_TYPE = ?
and COUNTRY_CODE = ?
and ITEM_NO = ?
and ITEM_TYPE = ?
and CURRENCY_CODE = ?
and PRICE_TYPE = ?
and FROM_TIME = ?
Total rows 10k, columns 14, time taking to process is 35 mins.总行数 10k,列 14,处理时间为 35 分钟。
After creating the indexes on all the 8 columns of where clause, the execution time decreased to 1 second.在 where 子句的所有 8 列上创建索引后,执行时间减少到 1 秒。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.