PSQL Running Tasks

First check what are the running processes by

SELECT * FROM pg_stat_activity WHERE state = 'active';

Find the process you want to kill, then type:

SELECT pg_cancel_backend()

If the process cannot be killed, try:

SELECT pg_terminate_backend()

Source – StackOverflow

Leave a comment