.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "PG_ACTIVITY 1" .TH PG_ACTIVITY 1 "2023-06-01" "pg_activity 3.4.2" "Command line tool for PostgreSQL server activity monitoring." .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" pg_activity \- Realtime PostgreSQL database server monitoring tool .SH "SYNOPSIS" .IX Header "SYNOPSIS" \&\fBpg_activity\fR [option..] [connection string] .SH "DESCRIPTION" .IX Header "DESCRIPTION" Command line tool for PostgreSQL server activity monitoring. .PP pg_activity must run on the same server as the instance and as the user running the instance (or root) to show \&\s-1CPU, MEM, READ\s0 or \s-1WRITE\s0 columns and other system information. .SS "\s-1THE HEADER\s0" .IX Subsection "THE HEADER" The first line of the header displays PostgreSQL's version, the host name, the connection string, the refresh rate and the duration mode. .PP The header is then divided in tree groups: \fBinstance\fR, \fBworker processes\fR, \&\fBsystem\fR. The information is filtered according to the filter parameters when appropriate. This is shown in the following descriptions with the \*(L"(filtered)\*(R" mention. Depending on the version you are on, some information might not be available. In that case, it will be replaced by a dash. .PP The \fBinstance\fR group displays information aubout the PostgreSQL instance (or cluster). This group can be displayed or hidden with the I Key. .PP Global : .IP "\- \fBuptime\fR: since when is the instance running;" 2 .IX Item "- uptime: since when is the instance running;" .PD 0 .IP "\- \fBdbs size\fR: total size of the databases (filtered);" 2 .IX Item "- dbs size: total size of the databases (filtered);" .IP "\- \fBgrowth\fR: growth in B/s of the databases (filtered);" 2 .IX Item "- growth: growth in B/s of the databases (filtered);" .IP "\- \fBcache hit ratio\fR: the percentage of page read from the PostgreSQL's cache since last snapshot (filtered)." 2 .IX Item "- cache hit ratio: the percentage of page read from the PostgreSQL's cache since last snapshot (filtered)." .PD .PP Sessions : .IP "\- \fBtotal\fR: session count (filtered) / max_connections;" 2 .IX Item "- total: session count (filtered) / max_connections;" .PD 0 .IP "\- \fBactive\fR: number of active sessions (filtered);" 2 .IX Item "- active: number of active sessions (filtered);" .IP "\- \fBidle\fR: number of idle sessions (filtered);" 2 .IX Item "- idle: number of idle sessions (filtered);" .IP "\- \fBidle in txn\fR: number of sessions who are in the idle in transaction state (filtered);" 2 .IX Item "- idle in txn: number of sessions who are in the idle in transaction state (filtered);" .IP "\- \fBidle in txn abrt\fR: number of sessions who are in the idle in transaction aborted state (filtered);" 2 .IX Item "- idle in txn abrt: number of sessions who are in the idle in transaction aborted state (filtered);" .IP "\- \fBwaiting\fR: number of sessions that are waiting for a lock (filtered)." 2 .IX Item "- waiting: number of sessions that are waiting for a lock (filtered)." .PD .PP Activity : .IP "\- \fBtps\fR: transaction per second (sum of commit & rollback for all databases / time elapsed since last snapshot) (filtered);" 2 .IX Item "- tps: transaction per second (sum of commit & rollback for all databases / time elapsed since last snapshot) (filtered);" .PD 0 .IP "\- \fBinsert/s\fR: number of inserts per second (filtered);" 2 .IX Item "- insert/s: number of inserts per second (filtered);" .IP "\- \fBupdates/s\fR: number of updates per second (filtered);" 2 .IX Item "- updates/s: number of updates per second (filtered);" .IP "\- \fBdelete/s\fR: number of deletes per second (filtered);" 2 .IX Item "- delete/s: number of deletes per second (filtered);" .IP "\- \fBtuples returned/s\fR: number of tuples returned per second (filtered);" 2 .IX Item "- tuples returned/s: number of tuples returned per second (filtered);" .IP "\- \fBtemp files\fR: number of temporary files created on the instance;" 2 .IX Item "- temp files: number of temporary files created on the instance;" .IP "\- \fBtemp size\fR: total temporary file size on the instance." 2 .IX Item "- temp size: total temporary file size on the instance." .PD .PP The \fBworker processes\fR group displays information about backgroup workers, autovacuum processes, wal senders and wal receivers. It also gives information about replication slots. Except for the autovacuum workers count, most of this information is not related to a specific database, therefore their values will be zero when the data is filtered. .PP Worker processes: .IP "\- \fBtotal\fR: total worker count / maximum number of worker slots, parallel workers and logical replication wokers are taken from this amount (filtered);" 2 .IX Item "- total: total worker count / maximum number of worker slots, parallel workers and logical replication wokers are taken from this amount (filtered);" .PD 0 .IP "\- \fBlogical wokers\fR: logical replication worker count / maximum number of logical replication wokers (filtered);" 2 .IX Item "- logical wokers: logical replication worker count / maximum number of logical replication wokers (filtered);" .IP "\- \fBparallel workers\fR: parallel worker count for maintenance & queries / maximum number of parallel workers (filtered)." 2 .IX Item "- parallel workers: parallel worker count for maintenance & queries / maximum number of parallel workers (filtered)." .PD .PP Other processes & information: .IP "\- \fBautovacuum workers\fR: number of autovacuum worker in action / maximum number of autovacuum workers (filtered);" 2 .IX Item "- autovacuum workers: number of autovacuum worker in action / maximum number of autovacuum workers (filtered);" .PD 0 .IP "\- \fBwal senders\fR: number of wal senders / maximum number of wal senders processes (filtered);" 2 .IX Item "- wal senders: number of wal senders / maximum number of wal senders processes (filtered);" .IP "\- \fBwal receivers\fR: number of wal receivers / maximum number of wal receiver processes (filtered);" 2 .IX Item "- wal receivers: number of wal receivers / maximum number of wal receiver processes (filtered);" .IP "\- \fBrepl. slots\fR: number of replication slots / maximum number of replication slots (filtered)." 2 .IX Item "- repl. slots: number of replication slots / maximum number of replication slots (filtered)." .PD .PP The last group displays \fBsystem information\fR: .IP "\- \fBMem.\fR: total / free / used and buff+cached memory with the related percentages;" 2 .IX Item "- Mem.: total / free / used and buff+cached memory with the related percentages;" .PD 0 .IP "\- \fBSwap\fR: total / free / used swap;" 2 .IX Item "- Swap: total / free / used swap;" .IP "\- \fB\s-1IO\s0\fR: the number of \s-1IO\s0 per second, current Read and Write thoughput (aggregated data gathered with the psutil library);" 2 .IX Item "- IO: the number of IO per second, current Read and Write thoughput (aggregated data gathered with the psutil library);" .IP "\- \fBLoad\fR: \s-1CPU\s0 load for the last 1, 5, 15 minutes;" 2 .IX Item "- Load: CPU load for the last 1, 5, 15 minutes;" .PD .SS "\s-1THE RUNNING QUERIES PANEL\s0" .IX Subsection "THE RUNNING QUERIES PANEL" The running queries panel shows all running queries, transactions or backends (depending on the \fB\s-1DURATION_MODE\s0\fR setting) which have lasted for more than \&\fBmin duration\fR seconds. It displays the following information: .IP "\- \fB\s-1PID\s0\fR: process id of the backend which executes the query;" 2 .IX Item "- PID: process id of the backend which executes the query;" .PD 0 .IP "\- \fB\s-1DATABASE\s0\fR: database specified in the connection string;" 2 .IX Item "- DATABASE: database specified in the connection string;" .IP "\- \fB\s-1APP\s0\fR: application name specified in the connection string;" 2 .IX Item "- APP: application name specified in the connection string;" .IP "\- \fB\s-1USER\s0\fR: user name specified in the connection string;" 2 .IX Item "- USER: user name specified in the connection string;" .ie n .IP "\- \fB\s-1CLIENT\s0\fR: client address or ""local"" in case of linux socker connection;" 2 .el .IP "\- \fB\s-1CLIENT\s0\fR: client address or ``local'' in case of linux socker connection;" 2 .IX Item "- CLIENT: client address or local in case of linux socker connection;" .IP "\- \fBCPU%\fR: percentage of \s-1CPU\s0 used by the backend as reported by the psutil library;" 2 .IX Item "- CPU%: percentage of CPU used by the backend as reported by the psutil library;" .IP "\- \fBMEM%\fR: percentage of memory used by the backend as reported by the psutil library;" 2 .IX Item "- MEM%: percentage of memory used by the backend as reported by the psutil library;" .IP "\- \fBREAD/s\fR: read thruput as reported by the psutil library;" 2 .IX Item "- READ/s: read thruput as reported by the psutil library;" .IP "\- \fBWRITE/s\fR: write thruput as reported by the psutil library;" 2 .IX Item "- WRITE/s: write thruput as reported by the psutil library;" .IP "\- \fB\s-1TIME\s0\fR: time since the beginning of the query / transaction / backend start depending on the \fB\s-1DURATION_MODE\s0\fR currently in use;" 2 .IX Item "- TIME: time since the beginning of the query / transaction / backend start depending on the DURATION_MODE currently in use;" .IP "\- \fBWaiting\fR: for PostgreSQL 9.6+: a specific wait event or nothing. Otherwise, a boolean indicating if we are waiting for a Lock;" 2 .IX Item "- Waiting: for PostgreSQL 9.6+: a specific wait event or nothing. Otherwise, a boolean indicating if we are waiting for a Lock;" .IP "\- \fB\s-1IOW\s0\fR: boolean indicating that the process is waiting for \s-1IO\s0 as reported by the psutil library;" 2 .IX Item "- IOW: boolean indicating that the process is waiting for IO as reported by the psutil library;" .IP "\- \fBstate\fR: state of the backend;" 2 .IX Item "- state: state of the backend;" .IP "\- \fBQuery\fR: the query." 2 .IX Item "- Query: the query." .PD .SS "\s-1THE WAITING QUERIES PANEL\s0" .IX Subsection "THE WAITING QUERIES PANEL" The waiting queries view displays queries that are waiting for a lock. It shows the following information: .IP "\- \fB\s-1PID\s0\fR: process id of the backend which executes the query;" 2 .IX Item "- PID: process id of the backend which executes the query;" .PD 0 .IP "\- \fB\s-1DATABASE\s0\fR: database specified in the connection string;" 2 .IX Item "- DATABASE: database specified in the connection string;" .IP "\- \fB\s-1APP\s0\fR: application name specified in the connection string;" 2 .IX Item "- APP: application name specified in the connection string;" .IP "\- \fB\s-1USER\s0\fR: user name specified in the connection string;" 2 .IX Item "- USER: user name specified in the connection string;" .ie n .IP "\- \fB\s-1CLIENT\s0\fR: client address or ""local"" in case of linux socker connection;" 2 .el .IP "\- \fB\s-1CLIENT\s0\fR: client address or ``local'' in case of linux socker connection;" 2 .IX Item "- CLIENT: client address or local in case of linux socker connection;" .IP "\- \fB\s-1RELATION\s0\fR: the name of the relation being locked if applicable;" 2 .IX Item "- RELATION: the name of the relation being locked if applicable;" .IP "\- \fB\s-1TYPE\s0\fR: the type of lock;" 2 .IX Item "- TYPE: the type of lock;" .IP "\- \fB\s-1MODE\s0\fR: the mode of the lock;" 2 .IX Item "- MODE: the mode of the lock;" .IP "\- \fB\s-1TIME+\s0\fR: the duration of the query, transaction or session depending on the \fB\s-1DURATION_MODE\s0\fR setting;" 2 .IX Item "- TIME+: the duration of the query, transaction or session depending on the DURATION_MODE setting;" .IP "\- \fBstate\fR: the state of the transaction;" 2 .IX Item "- state: the state of the transaction;" .IP "\- \fBQuery\fR: the query." 2 .IX Item "- Query: the query." .PD .SS "\s-1THE BLOCKING QUERIES PANEL\s0" .IX Subsection "THE BLOCKING QUERIES PANEL" The blocking queries view displays the queries that lock an object which is required by another session. It shows following information: .IP "\- \fB\s-1PID\s0\fR: process id of the backend which executes the query;" 2 .IX Item "- PID: process id of the backend which executes the query;" .PD 0 .IP "\- \fB\s-1DATABASE\s0\fR: database specified in the connection string;" 2 .IX Item "- DATABASE: database specified in the connection string;" .IP "\- \fB\s-1APP\s0\fR: application name specified in the connection string;" 2 .IX Item "- APP: application name specified in the connection string;" .IP "\- \fB\s-1USER\s0\fR: user name specified in the connection string;" 2 .IX Item "- USER: user name specified in the connection string;" .ie n .IP "\- \fB\s-1CLIENT\s0\fR: client address or ""local"" in case of linux socker connection;" 2 .el .IP "\- \fB\s-1CLIENT\s0\fR: client address or ``local'' in case of linux socker connection;" 2 .IX Item "- CLIENT: client address or local in case of linux socker connection;" .IP "\- \fB\s-1RELATION\s0\fR: the name of the relation being locked if applicable;" 2 .IX Item "- RELATION: the name of the relation being locked if applicable;" .IP "\- \fB\s-1TYPE\s0\fR: the type of lock;" 2 .IX Item "- TYPE: the type of lock;" .IP "\- \fB\s-1MODE\s0\fR: the mode of the lock;" 2 .IX Item "- MODE: the mode of the lock;" .IP "\- \fB\s-1TIME+\s0\fR: the duration of the query, transaction or session depending on the \fB\s-1DURATION_MODE\s0\fR setting;" 2 .IX Item "- TIME+: the duration of the query, transaction or session depending on the DURATION_MODE setting;" .IP "\- \fBWaiting\fR: for PostgreSQL 9.6+: a specific wait event or nothing. Otherwise, a boolean indicating if we are waiting for a Lock;" 2 .IX Item "- Waiting: for PostgreSQL 9.6+: a specific wait event or nothing. Otherwise, a boolean indicating if we are waiting for a Lock;" .IP "\- \fBstate\fR: the state of the transaction;" 2 .IX Item "- state: the state of the transaction;" .IP "\- \fBQuery\fR: the query." 2 .IX Item "- Query: the query." .PD .SH "COMMAND-LINE OPTIONS" .IX Header "COMMAND-LINE OPTIONS" .SS "\s-1OPTIONS\s0" .IX Subsection "OPTIONS" .IP "\fB\-\-blocksize=BLOCKSIZE\fR" 2 .IX Item "--blocksize=BLOCKSIZE" .Vb 1 \& Filesystem blocksize (default: 4096). .Ve .IP "\fB\-\-rds\fR" 2 .IX Item "--rds" .Vb 1 \& Enable support for AWS RDS (implies \-\-no\-tempfiles and filters out the rdsadmin database from space calculation). .Ve .IP "\fB\-\-output=FILEPATH\fR" 2 .IX Item "--output=FILEPATH" .Vb 1 \& Store running queries as CSV. .Ve .IP "\fB\-\-no\-db\-size\fR" 2 .IX Item "--no-db-size" .Vb 1 \& Skip total size of DB. .Ve .IP "\fB\-\-no\-tempfiles\fR" 2 .IX Item "--no-tempfiles" .Vb 1 \& Skip tempfile count and size. .Ve .IP "\fB\-\-no\-walreceiver\fR" 2 .IX Item "--no-walreceiver" .Vb 1 \& Skip walreceiver checks. .Ve .IP "\fB\-\-no\-walreceiver\fR" 2 .IX Item "--no-walreceiver" .Vb 1 \& Skip walreceiver checks. .Ve .IP "\fB\-w, \-\-wrap\-query\fR" 2 .IX Item "-w, --wrap-query" .Vb 1 \& Wrap query column instead of truncating. .Ve .IP "\fB\-\-min\-duration=SECONDS\fR" 2 .IX Item "--min-duration=SECONDS" .Vb 1 \& Don\*(Aqt display queries with smaller than specified duration (in seconds). .Ve .IP "\fB\-\-filter=FIELD:REGEX\fR" 2 .IX Item "--filter=FIELD:REGEX" .Vb 1 \& Filter activities with a (case insensitive) regular expression applied on selected fields. Known fields are: dbname. \& \& Note: It\*(Aqs possible to filter out a database with negative lookahead, eg: \*(Aq^(?!database_name)\*(Aq .Ve .IP "\fB\-\-help\fR" 2 .IX Item "--help" .Vb 1 \& Show this help message and exit. .Ve .IP "\fB\-\-version\fR" 2 .IX Item "--version" .Vb 1 \& Show program\*(Aqs version number and exit. .Ve .SS "\s-1CONNECTION OPTIONS\s0" .IX Subsection "CONNECTION OPTIONS" .IP "\fB\-U \s-1USERNAME\s0\fR, \fB\-\-username=USERNAME\fR" 2 .IX Item "-U USERNAME, --username=USERNAME" .Vb 1 \& Database user name. .Ve .IP "\fB\-p \s-1PORT\s0\fR, \fB\-\-port=PORT\fR" 2 .IX Item "-p PORT, --port=PORT" .Vb 1 \& Database server port. .Ve .IP "\fB\-h \s-1HOSTNAME\s0\fR, \fB\-\-host=HOSTNAME\fR" 2 .IX Item "-h HOSTNAME, --host=HOSTNAME" .Vb 1 \& Database server host or socket directory. .Ve .IP "\fB\-d \s-1DBNAME\s0\fR, \fB\-\-dbname=DBNAME\fR" 2 .IX Item "-d DBNAME, --dbname=DBNAME" .Vb 1 \& Database name to connect to. .Ve .SS "\s-1PROCESS DISPLAY OPTIONS\s0" .IX Subsection "PROCESS DISPLAY OPTIONS" .IP "\fB\-\-no\-pid\fR" 2 .IX Item "--no-pid" .Vb 1 \& Disable PID. .Ve .IP "\fB\-\-no\-database\fR" 2 .IX Item "--no-database" .Vb 1 \& Disable DATABASE. .Ve .IP "\fB\-\-no\-user\fR" 2 .IX Item "--no-user" .Vb 1 \& Disable USER. .Ve .IP "\fB\-\-no\-client\fR" 2 .IX Item "--no-client" .Vb 1 \& Disable CLIENT. .Ve .IP "\fB\-\-no\-cpu\fR" 2 .IX Item "--no-cpu" .Vb 1 \& Disable CPU%. .Ve .IP "\fB\-\-no\-mem\fR" 2 .IX Item "--no-mem" .Vb 1 \& Disable MEM%. .Ve .IP "\fB\-\-no\-read\fR" 2 .IX Item "--no-read" .Vb 1 \& Disable READ/s. .Ve .IP "\fB\-\-no\-write\fR" 2 .IX Item "--no-write" .Vb 1 \& Disable WRITE/s. .Ve .IP "\fB\-\-no\-time\fR" 2 .IX Item "--no-time" .Vb 1 \& Disable TIME+. .Ve .IP "\fB\-\-no\-wait\fR" 2 .IX Item "--no-wait" .Vb 1 \& Disable W. .Ve .IP "\fB\-\-no\-app\-name\fR" 2 .IX Item "--no-app-name" .Vb 1 \& Disable App. .Ve .SS "\s-1OTHER DISPLAY OPTIONS\s0" .IX Subsection "OTHER DISPLAY OPTIONS" .IP "\fB\-\-no\-inst\-info\fR" 2 .IX Item "--no-inst-info" .Vb 1 \& Display instance information in header. .Ve .IP "\fB\-\-no\-sys\-info\fR" 2 .IX Item "--no-sys-info" .Vb 1 \& Display system information in header. .Ve .IP "\fB\-\-no\-proc\-info\fR" 2 .IX Item "--no-proc-info" .Vb 1 \& Display workers process information in header. .Ve .IP "\fB\-\-refresh\fR" 2 .IX Item "--refresh" .Vb 1 \& Change the refresh rate, allowed values are: 0.5, 1, 2, 3, 4, 5 (in seconds) (default: 2). .Ve .SH "ENVIRONMENT VARIABLES" .IX Header "ENVIRONMENT VARIABLES" .RS 2 All the environment variables supported by libpq (PostgreSQL's query protocol) are supported by pg_activity. .Sp See: https://www.postgresql.org/docs/current/libpq\-envars.html .RE .SH "INTERACTIVE COMMANDS" .IX Header "INTERACTIVE COMMANDS" .IP "\fBr\fR Sort by READ/s, descending." 2 .IX Item "r Sort by READ/s, descending." .PD 0 .IP "\fBw\fR Sort by WRITE/s, descending." 2 .IX Item "w Sort by WRITE/s, descending." .IP "\fBc\fR Sort by CPU%, descending." 2 .IX Item "c Sort by CPU%, descending." .IP "\fBm\fR Sort by MEM%, descending." 2 .IX Item "m Sort by MEM%, descending." .IP "\fBt\fR Sort by \s-1TIME+,\s0 descending." 2 .IX Item "t Sort by TIME+, descending." .IP "\fBT\fR Change duration mode: query, transaction, backend." 2 .IX Item "T Change duration mode: query, transaction, backend." .IP "\fBSpace\fR Pause on/off." 2 .IX Item "Space Pause on/off." .IP "\fBv\fR Change queries display mode: full, truncated, indented." 2 .IX Item "v Change queries display mode: full, truncated, indented." .IP "\fB\s-1UP / DOWN\s0\fR Scroll process list." 2 .IX Item "UP / DOWN Scroll process list." .IP "\fBk / j\fR Scroll process list." 2 .IX Item "k / j Scroll process list." .IP "\fBq\fR Quit." 2 .IX Item "q Quit." .IP "\fB+\fR Increase refresh time. Maximum value: 3s." 2 .IX Item "+ Increase refresh time. Maximum value: 3s." .IP "\fB\-\fR Decrease refresh time. Minimum Value: 1s." 2 .IX Item "- Decrease refresh time. Minimum Value: 1s." .IP "\fBF1/1\fR Running queries monitoring." 2 .IX Item "F1/1 Running queries monitoring." .IP "\fBF2/2\fR Waiting queries monitoring." 2 .IX Item "F2/2 Waiting queries monitoring." .IP "\fBF3/3\fR Blocking queries monitoring." 2 .IX Item "F3/3 Blocking queries monitoring." .IP "\fBh\fR Help page." 2 .IX Item "h Help page." .IP "\fBR\fR Refresh." 2 .IX Item "R Refresh." .IP "\fBD\fR Refresh database size." 2 .IX Item "D Refresh database size." .PD .SH "NAVIGATION MODE" .IX Header "NAVIGATION MODE" .IP "\fB\s-1UP /\s0 k\fR Move up the cursor." 2 .IX Item "UP / k Move up the cursor." .PD 0 .IP "\fB\s-1DOWN /\s0 j\fR Move down the cursor." 2 .IX Item "DOWN / j Move down the cursor." .IP "\fB\s-1PAGE UP\s0\fR Move the cursor to the first line." 2 .IX Item "PAGE UP Move the cursor to the first line." .IP "\fB\s-1PAGE DOWN\s0\fR Move the cursor to the last line." 2 .IX Item "PAGE DOWN Move the cursor to the last line." .IP "\fBK\fR Terminate the current backend/tagged backends." 2 .IX Item "K Terminate the current backend/tagged backends." .IP "\fBC\fR Cancel the current backend/tagged backends." 2 .IX Item "C Cancel the current backend/tagged backends." .IP "\fBSpace\fR Tag or untag the process." 2 .IX Item "Space Tag or untag the process." .IP "\fBq\fR Quit." 2 .IX Item "q Quit." .IP "\fBOther\fR Back to activity." 2 .IX Item "Other Back to activity." .PD .SH "MISSING DATA IN THE UI?" .IX Header "MISSING DATA IN THE UI?" pg_activity is best used with a user owning the \s-1SUPERUSER\s0 privilege. Ordinary users can only see all the information about their own sessions (sessions belonging to a role that they are a member of). In rows about other sessions, many columns will be null or not picked by pg_activity. It will impact both the information gathered in the \fB\s-1HEADER\s0\fR section and the \fB\s-1ACTIVITY PANEL\s0\fR .PP If a user doesn't have the \s-1CONNECT\s0 privilege on a database the \&\fBpg_database_size()\fR function will fail and pg_activity will crash. The \&\fB\-\-no\-db\-size\fR option can be used in this case. This situation is frequent for cloud database where the service provider has created a service database with a restricted access. .PP Some settings are visible only to superusers or members of pg_read_all_settings such as the data_directory guc. If the user cannot read this parameter or access the pid file in the \s-1PGDATA\s0 directory, the \fBsystem information \s-1HEADER\s0\fR group will not be displayed. The \fB\f(CB%CPU\fB\fR, \fB\f(CB%MEM\fB\fR, \fBRead/s\fR and \fBWrite/s\fR columns will also be missing from the \fB\s-1ACTIVITY PANEL\s0\fR. .PP On some \s-1OS\s0 like MacOS, psutils.\fBio_counters()\fR is not implemented. The effect are the same as those described when data_directory is not readable. .PP pg_activity needs to access the pgsql_tmp directory stored in all tablespaces in order to compute the number and size of the temporary files. This requires the usage of the \fBpg_ls_tmpdir()\fR function (or \fBpg_ls_dir()\fR and \fBpg_stats_file()\fR for versions older than PostgreSQL 12). The user needs to own the \s-1SUPERUSER\s0 privilege, be a member of pg_read_server_files or have \s-1EXECUTE\s0 rights on the function to fetch the information. When the number of tempfiles grows a lot, the query might also timeout. The first failure to access this data will disable tempfile statistics. The feature can be disabled with \&\fB\-\-no\-tempfiles\fR. .PP Aurora doesn't provide the \fBpg_stat_get_wal_receiver()\fR function. Therefore there is no wal receiver data in the \fBprocess & information \s-1HEADER\s0\fR group. The first failure to access this data might be logged by the PostgreSQL, the following checks will be skipped. Wal receiver checks can be completely disabled with \fB\-\-no\-walreceiver\fR. .PP Finally, some information is not available in older version of PostgreSQL, the fields will therefore be empty. .SH "EXAMPLES" .IX Header "EXAMPLES" PGPASSWORD='mypassword' pg_activity \-U pgadmin \-h 127.0.0.1 \-\-no\-client .PP pg_activity \-h /var/run/postgresql .PP pg_activity \-h myserver \-p 5433 \-d nagios \-U nagios