Databases, Quick Tips
     

Monitoring Running Queries in Postgres

Another one for the Quick Tips category – have you ever needed to see what queries are running against your Postgres database? Perhaps a nightly process hasn’t finished yet and you’re curious if it’s deadlocked? Or maybe the database server is using 100% CPU and you’re not sure why? These, along with many others, are all reasons I have needed to peek under the hood of Postgres.

Doing so is pretty simple, just execute the following query:

And you’ll get a list of running queries (sans the above query) with relevant information, like the current run time, the status of the query, and the SQL itself.

Never miss an article! Subscribe to my newsletter and I'll keep you updated with the latest content.

 

About Jason

Jason is an experienced entrepreneur & software developer skilled in leadership, mobile development, data synchronization, and SaaS architecture. He earned his Bachelor of Science (B.S.) in Computer Science from Arkansas State University.
View all posts by Jason →

Leave a Reply

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