Answers for "postgres long runnning queries"

SQL
3

postgres kill running query

--Stop the query normally
SELECT pg_cancel_backend(pid);

--Terminate immediately
SELECT pg_terminate_backend(pid);
Posted by: Guest on April-09-2020
0

postgres get running query

--Version > 9.2
SELECT pid, age(clock_timestamp(), query_start), usename, query 
FROM pg_stat_activity 
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' 
ORDER BY query_start desc;
Posted by: Guest on April-09-2020

Code answers related to "postgres long runnning queries"

Code answers related to "SQL"

Browse Popular Code Answers by Language