select gp_segment_id, count(*) from gp_dist_random('pg_class') group by 1 order by 1;
This query test to make sure it is functional on all segments. one row should be returned for each primary segment. If this fails there is an issue dispatching to some segments in the cluster. This is a rare event. Check the hosts that are not able to be dispatched to ensure there is no hardware or networking issue.