POSTGRESQL DATABASE MONITORING

 

In this article I will share some monitoring scripts about postgresql.

 

To Check if the Postgresql service is running via OS(linux):

 

To Check the RAM / CPU status via OS(linux):

 

To Check the Disk Status via OS(linux9:

 

To Check the Number of the Connection Count:

You can find the following information with the following script.

How many connections in the database?
What is Transaction Count?
Write to disk,
Read from cache,
What is the number of rows inserted, deleted etc?

 

 

However, to have this table, after installing the Postgresql9.6-contrib package, it is necessary to create the following extension by connecting to the database with psql.

 

Long Running Queries:

 

Table and index access statistics:

 

How long have the existing queries been working:

 

To stop a query:

 

To kill if the query does not stop using the above method:

 

To see locked objects:

 

To see the size of a database:

or

After connecting with psql, you can see the sizes of all databases with l+ command.

 

To see the size of a table:

After connecting to database with psql;

 

You can read the following articles:

How To Get Size Of All Tables And Database On PostgreSQL“,

How to List PostgreSQL Users and Permission“,

How To List All PostgreSQL Databases“,

How to Get The Size of all Postgres Databases

Engin Yilmaz
Author: Engin Yilmaz

Leave a Reply

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