SQL to review distribution across all segments

posted Apr 28, 2017, 12:18 PM by Sachchida Ojha
SELECT gp_segment_id, count(*) , abs(count(*) - avg(count(*)) over(order by gp_segment_id rows between unbounded preceding and unbounded following))/count(*) skew
FROM public.abc
GROUP BY gp_segment_id
ORDER BY gp_segment_id;
Comments