[JIRA] (HHH-16907) Improve performance of flushing