Fixes #8048: n+1 query selecting multiple hosts