api: avoid some indexer queries
api: avoid some indexer queries

If no resource_id or no metric names are passed in the batch payload,
we can skip some sql queries.

This change does that.

Closes-bug: #911

sileht/gnocchi,sileht/gnocchi,gnocchixyz/gnocchi,gnocchixyz/gnocchi