Fix issue to execute optimization SQL