SQL to review distribution across all segments

posted Aug 23, 2014, 9:25 AM 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