Speed up slow metrics queries

There is no need for HAVING on these queries, so
replaced with WHERE

Change-Id: I55fe17969888ba0d6cfffcab3166da9f275aa13c