Optimise import performance Closes #64924 See merge request gitlab-org/gitlab-ce!31045
flat_map
map
flatten