  We investigate if, for a fixed number density of targets and redshift, there
is an optimal way to select a galaxy sample in order to measure the baryon
acoustic oscillation (BAO) scale, which is used as a standard ruler to
constrain the cosmic expansion. Using the mock galaxy catalogue built by Smith
et al. in the Millennium-XXL N-body simulation with a technique to assign
galaxies to dark matter haloes based on halo occupation distribution modelling,
we consider the clustering of galaxies selected by luminosity, colour and local
density. We assess how well the BAO scale can be extracted by fitting a
template to the power spectrum measured for each sample. We find that the BAO
peak position is recovered equally well for samples defined by luminosity or
colour, while there is a bias in the BAO scale recovered for samples defined by
density. The BAO position is contracted to smaller scales for the densest
galaxy quartile and expanded to large scales for the two least dense galaxy
quartiles. For fixed galaxy number density, density-selected samples have
higher uncertainties in the recovered BAO scale than luminosity- or
colour-selected samples.
