Use joins instead of subqueries for metadata filtering

Previously, Ceilometer used subqueries to apply metadata filters. These
subqueries, however, defeated MySQL's query optimizer, leading to absurdly
bad performance. In our production setup, this patch improved performance on
two metadata filters by up to 10000x.

Change-Id: Ie3bea14d05fb63a5565e2d5cced74068955b8f08
Closes-bug: #1320772