SELECT
DATEDIFF(minutes, starttime, GETDATE()) AS duration_minutes,
*,
'SELECT PG_CANCEL_BACKEND(' || pid || ');'
FROM
STV_RECENTS
WHERE
status = 'Running'
ORDER BY
starttime ASC
;
SELECT PG_CANCEL_BACKEND(pid)
SELECT DISTINCT
pid
FROM
STV_RECENTS
WHERE
status = 'Running'
AND user_name = 'xxx'
;