How to terminate PostgreSQL query

We can terminate the PostgreSQL query by terminating the corresponding process id.

Step1: Login to PostgreSQL shell as admin user.

Step2: List out the processes that are running currently and note down the process id that we need to stop.

>SELECT * FROM pg_stat_activity;

Step3: Terminate the required process id.

>SELECT pg_terminate_backend(PID);

Here we need to replace PID with the corresponding process id.

That's all…

Leave a Reply

Your email address will not be published. Required fields are marked *