GP - To gather orphan process information
Generating the report of process and checking if the total segments = total sessions
NOTE: Run this SQL from postgres database
SELECT
'con'|| a.mppsessionid AS "Session ID",
b.total_seg AS "Total Segments",
count(a.*) AS "Total Sessions"
FROM
(SELECT DISTINCT mppsessionid, gp_segment_id
FROM pg_locks
WHERE mppsessionid not in
(SELECT sess_id
FROM pg_stat_activity
WHERE procpid!=pg_backend_pid()
OR current_query!=''
OR waiting='t')
AND mppsessionid != 0
) a,
(SELECT COUNT(*) AS total_seg FROM gp_segment_configuration WHERE role='p') b
GROUP BY 1,2
HAVING COUNT(a.*) < b.total_seg
ORDER BY 3;
Comments
Post a Comment