Optimize execution time of a major chunk from the SQL updates