)) from t_distinct; explain (costs off, nodes off) select avg(distinct(b::numeric(0,0)))+0, d from t_distinct group by d order by 0; select avg(distinct(b::numeric(0,0)))+0, d from t_distinct group by d order by 0; explain (costs off, nodes off) select avg(distinct(c))+count(distinct(c)), b from t_distinct group by b order by 0