perf improvement to not use subqueries for the state avg.