SQL to review distribution across all segments
Post date: Aug 23, 2014 4:25:49 PM
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;