Scroll to navigation

PG_ACTIVITY(1) Command line tool for PostgreSQL server activity monitoring. PG_ACTIVITY(1)

NAME

pg_activity - Realtime PostgreSQL database server monitoring tool

SYNOPSIS

pg_activity [option..] [connection string]

DESCRIPTION

Command line tool for PostgreSQL server activity monitoring.

pg_activity must run on the same server as the instance and as the user running the instance (or root) to show CPU, MEM, READ or WRITE columns and other system information.

THE HEADER

The first line of the header displays PostgreSQL's version, the host name, the connection string and the refresh rate.

The rest of the header displays the following information:

THE RUNNING QUERIES PANEL

The running queries panel shows all running queries, transactions or backends (depending on the DURATION_MODE setting) which have lasted for more than min duration seconds. It displays the following information:

THE WAITING QUERIES PANNEL

The waiting queries view displays queries that are wainting for a lock. It shows the following information:

THE BLOCKING QUERIES PANNEL

The blocking queries view displays the queries that lock an object which is required by another session. It shows following information:

COMMAND-LINE OPTIONS

        Database user name.
    
        Database server port.
    
        Database server host or socket directory.
    
    Database name to connect to.
    
        Filesystem blocksize (default: 4096).
    
        Enable support for AWS RDS.
    
        Store running queries as CSV.
    
        Skip total size of DB.
    
        Queries display mode. Values: 1-TRUNCATED, 2-FULL(default), 3-INDENTED
    
        Duration mode. Values: 1-QUERY(default), 2-TRANSACTION, 3-BACKEND
    
        Don't display queries with smaller than specified duration (in seconds).
    
        Filter activities with a (case insensitive) regular expression applied on selected fields. Known fields are: dbname.
    
        Show this help message and exit.
    
        Show program's version number and exit.
    

ENVIRONMENT VARIABLES

All the environnement variables supported by libpq (PostgreSQL's query protocol) are supported by pg_activity.

See: https://www.postgresql.org/docs/current/libpq-envars.html

DISPLAY OPTIONS

        Disable PID.
    
        Disable DATABASE.
    
        Disable USER.
    
        Disable CLIENT.
    
        Disable CPU%.
    
        Disable MEM%.
    
        Disable READ/s.
    
        Disable WRITE/s.
    
        Disable TIME+.
    
        Disable W.
    
        Disable App.
    

INTERACTIVE COMMANDS

+ Increase refresh time. Maximum value: 3s

NAVIGATION MODE

EXAMPLES

PGPASSWORD='mypassword' pg_activity -U pgadmin -h 127.0.0.1 --no-client

pg_activity -h /var/run/postgresql

pg_activity -h myserver -p 5433 -d nagios -U nagios

2021-08-05 pg_activity 2.2.1