Make error update query much faster