Linux/PostgreSQL: Getting service uptime

PHOTO EMBED

Sun Aug 28 2022 01:58:52 GMT+0000 (Coordinated Universal Time)

Saved by @marcopinero #sql #postgresql

/* SQL Command within postgres: */

SELECT now() - pg_postmaster_start_time() uptime

/* using psql command line utility deployed with Postgres: */
 
$> psql -c "SELECT now() - pg_postmaster_start_time() uptime"
content_copyCOPY

This sql script is used for knowing database service uptime in PostGreSQL using psql command line utility deployed with the database engine.