Saturday , September 23 2023

PostgreSQL up-time


There are countless ways of understanding how long PostgreSQL has been turned on.

In this article we will talk about 3 methods.


1)Using SQL:

SELECT CURRENT_DATE - (pg_postmaster_start_time())::DATE AS up_day, CURRENT_TIMESTAMP -pg_postmaster_start_time() AS up_time, pg_postmaster_start_time() AS start_time;


2)From Service Definitions:

Firstly, we look at the status of the service with the following query.


3) Using PID:

First we take the PID of the PostgreSQL master process.

ps hf -C postgres


That’s 485. Then we look at when the process begins. There are various ways of doing this. One of these;



About Şahap Aşçı

Leave a Reply

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