Reduce query for fetching people ids