MDL-70285 completion upgrade: fix performance of the MDL-69687 code