paint-brush
Postgres: Idle queries and pg_locksby@sanjaypojo
20,568 reads
20,568 reads

Postgres: Idle queries and pg_locks

by Sanjay Guruprasad2mMarch 29th, 2018
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

Postgres: Idle queries and pg_locks are easy to find when it seems to “hang” or be super slow on queries. You can simply kill the offending query with a single SQL statement. The easiest way to do this, is to run your query that seems to hang forever. Then run this query: SELECT * FROM pg_lock WHERE NOT GRANTED;. (PID from previous query) Then kill the query that is running (granted = true) Just take the PID from the query above and cancel it.

Companies Mentioned

Mention Thumbnail
Mention Thumbnail
featured image - Postgres: Idle queries and pg_locks
Sanjay Guruprasad HackerNoon profile picture
Sanjay Guruprasad

Sanjay Guruprasad

@sanjaypojo

L O A D I N G
. . . comments & more!

About Author

Sanjay Guruprasad HackerNoon profile picture
Sanjay Guruprasad@sanjaypojo

TOPICS

THIS ARTICLE WAS FEATURED IN...

Permanent on Arweave
Read on Terminal Reader
Read this story in a terminal
 Terminal
Read this story w/o Javascript
Read this story w/o Javascript
 Lite