1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569
|
.\" -*- mode: troff; coding: utf-8 -*-
.\" Automatically generated by Pod::Man v6.0.2 (Pod::Simple 3.45)
.\"
.\" 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
..
.\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>.
.ie n \{\
. ds C` ""
. ds C' ""
'br\}
.el\{\
. 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
.\"
.\" Required to disable full justification in groff 1.23.0.
.if n .ds AD l
.\" ========================================================================
.\"
.IX Title "PG_ACTIVITY 1"
.TH PG_ACTIVITY 1 2025-06-03 "pg_activity 3.6.1" "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
CPU, MEM, READ or WRITE columns and other system information.
.SS "THE HEADER"
.IX Subsection "THE HEADER"
The first line of the header displays PostgreSQL\*(Aqs 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 "(filtered)"
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\*(Aqs 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 workers are taken from this amount (filtered);" 2
.IX Item "- total: total worker count / maximum number of worker slots, parallel workers and logical replication workers are taken from this amount (filtered);"
.PD 0
.IP "\- \fBlogical workers\fR: logical replication worker count / maximum number of logical replication workers (filtered);" 2
.IX Item "- logical workers: logical replication worker count / maximum number of logical replication workers (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 "\- \fBIO\fR: the number of IO per second, current Read and Write throughput (aggregated data gathered with the psutil library);" 2
.IX Item "- IO: the number of IO per second, current Read and Write throughput (aggregated data gathered with the psutil library);"
.IP "\- \fBLoad\fR: CPU load for the last 1, 5, 15 minutes;" 2
.IX Item "- Load: CPU load for the last 1, 5, 15 minutes;"
.PD
.SS "THE RUNNING QUERIES PANEL"
.IX Subsection "THE RUNNING QUERIES PANEL"
The running queries panel shows all running queries, transactions or backends
(depending on the \fBDURATION_MODE\fR setting) which have lasted for more than
\&\fBmin duration\fR seconds. It displays the following information:
.IP "\- \fBPID\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 "\- \fBXMIN\fR: xmin horizon of the backend;" 2
.IX Item "- XMIN: xmin horizon of the backend;"
.IP "\- \fBDATABASE\fR: database specified in the connection string;" 2
.IX Item "- DATABASE: database specified in the connection string;"
.IP "\- \fBAPP\fR: application name specified in the connection string;" 2
.IX Item "- APP: application name specified in the connection string;"
.IP "\- \fBUSER\fR: user name specified in the connection string;" 2
.IX Item "- USER: user name specified in the connection string;"
.IP "\- \fBCLIENT\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 CPU 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 "\- \fBTIME\fR: time since the beginning of the query / transaction / backend start depending on the \fBDURATION_MODE\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 "\- \fBIOW\fR: boolean indicating that the process is waiting for IO 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 "THE WAITING QUERIES PANEL"
.IX Subsection "THE WAITING QUERIES PANEL"
The waiting queries view displays queries that are waiting for a lock. It
shows the following information:
.IP "\- \fBPID\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 "\- \fBDATABASE\fR: database specified in the connection string;" 2
.IX Item "- DATABASE: database specified in the connection string;"
.IP "\- \fBAPP\fR: application name specified in the connection string;" 2
.IX Item "- APP: application name specified in the connection string;"
.IP "\- \fBUSER\fR: user name specified in the connection string;" 2
.IX Item "- USER: user name specified in the connection string;"
.IP "\- \fBCLIENT\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 "\- \fBRELATION\fR: the name of the relation being locked if applicable;" 2
.IX Item "- RELATION: the name of the relation being locked if applicable;"
.IP "\- \fBTYPE\fR: the type of lock;" 2
.IX Item "- TYPE: the type of lock;"
.IP "\- \fBMODE\fR: the mode of the lock;" 2
.IX Item "- MODE: the mode of the lock;"
.IP "\- \fBTIME+\fR: the duration of the query, transaction or session depending on the \fBDURATION_MODE\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 "THE BLOCKING QUERIES PANEL"
.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 "\- \fBPID\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 "\- \fBDATABASE\fR: database specified in the connection string;" 2
.IX Item "- DATABASE: database specified in the connection string;"
.IP "\- \fBAPP\fR: application name specified in the connection string;" 2
.IX Item "- APP: application name specified in the connection string;"
.IP "\- \fBUSER\fR: user name specified in the connection string;" 2
.IX Item "- USER: user name specified in the connection string;"
.IP "\- \fBCLIENT\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 "\- \fBRELATION\fR: the name of the relation being locked if applicable;" 2
.IX Item "- RELATION: the name of the relation being locked if applicable;"
.IP "\- \fBTYPE\fR: the type of lock;" 2
.IX Item "- TYPE: the type of lock;"
.IP "\- \fBMODE\fR: the mode of the lock;" 2
.IX Item "- MODE: the mode of the lock;"
.IP "\- \fBTIME+\fR: the duration of the query, transaction or session depending on the \fBDURATION_MODE\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 CONFIGURATION
.IX Subsection "CONFIGURATION"
.IP "\fB\-P PROFILE\fR, \fB\-\-profile=PROFILE\fR" 2
.IX Item "-P PROFILE, --profile=PROFILE"
.Vb 1
\& Configuration profile matching a PROFILE.conf file in ${XDG_CONFIG_HOME:~/.config}/pg_activity/ or /etc/pg_activity/, or a built\-in profile.
.Ve
.SS OPTIONS
.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\-\-db\-size\fR, \fB\-\-no\-db\-size\fR" 2
.IX Item "--db-size, --no-db-size"
.Vb 1
\& Enable/disable total size of DB.
.Ve
.IP "\fB\-\-tempfiles\fR, \fB\-\-no\-tempfiles\fR" 2
.IX Item "--tempfiles, --no-tempfiles"
.Vb 1
\& Enable/disable tempfile count and size.
.Ve
.IP "\fB\-\-walreceiver\fR, \fB\-\-no\-walreceiver\fR" 2
.IX Item "--walreceiver, --no-walreceiver"
.Vb 1
\& Enable/disable 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 "CONNECTION OPTIONS"
.IX Subsection "CONNECTION OPTIONS"
.IP "\fB\-U USERNAME\fR, \fB\-\-username=USERNAME\fR" 2
.IX Item "-U USERNAME, --username=USERNAME"
.Vb 1
\& Database user name.
.Ve
.IP "\fB\-p PORT\fR, \fB\-\-port=PORT\fR" 2
.IX Item "-p PORT, --port=PORT"
.Vb 1
\& Database server port.
.Ve
.IP "\fB\-h HOSTNAME\fR, \fB\-\-host=HOSTNAME\fR" 2
.IX Item "-h HOSTNAME, --host=HOSTNAME"
.Vb 1
\& Database server host or socket directory.
.Ve
.IP "\fB\-d DBNAME\fR, \fB\-\-dbname=DBNAME\fR" 2
.IX Item "-d DBNAME, --dbname=DBNAME"
.Vb 1
\& Database name to connect to.
.Ve
.SS "PROCESS DISPLAY OPTIONS"
.IX Subsection "PROCESS DISPLAY OPTIONS"
.IP "\fB\-\-pid\fR, \fB\-\-no\-pid\fR" 2
.IX Item "--pid, --no-pid"
.Vb 1
\& Enable/disable PID.
.Ve
.IP "\fB\-\-xmin\fR, \fB\-\-no\-xmin\fR" 2
.IX Item "--xmin, --no-xmin"
.Vb 1
\& Enable/disable XMIN.
.Ve
.IP "\fB\-\-database\fR, \fB\-\-no\-database\fR" 2
.IX Item "--database, --no-database"
.Vb 1
\& Enable/disable DATABASE.
.Ve
.IP "\fB\-\-user\fR, \fB\-\-no\-user\fR" 2
.IX Item "--user, --no-user"
.Vb 1
\& Enable/disable USER.
.Ve
.IP "\fB\-\-client\fR, \fB\-\-no\-client\fR" 2
.IX Item "--client, --no-client"
.Vb 1
\& Enable/disable CLIENT.
.Ve
.IP "\fB\-\-cpu\fR, \fB\-\-no\-cpu\fR" 2
.IX Item "--cpu, --no-cpu"
.Vb 1
\& Enable/disable CPU%.
.Ve
.IP "\fB\-\-mem\fR, \fB\-\-no\-mem\fR" 2
.IX Item "--mem, --no-mem"
.Vb 1
\& Enable/disable MEM%.
.Ve
.IP "\fB\-\-read\fR, \fB\-\-no\-read\fR" 2
.IX Item "--read, --no-read"
.Vb 1
\& Enable/disable READ/s.
.Ve
.IP "\fB\-\-write\fR, \fB\-\-no\-write\fR" 2
.IX Item "--write, --no-write"
.Vb 1
\& Enable/disable WRITE/s.
.Ve
.IP "\fB\-\-time\fR, \fB\-\-no\-time\fR" 2
.IX Item "--time, --no-time"
.Vb 1
\& Enable/disable TIME+.
.Ve
.IP "\fB\-\-wait\fR, \fB\-\-no\-wait\fR" 2
.IX Item "--wait, --no-wait"
.Vb 1
\& Enable/disable W.
.Ve
.IP "\fB\-\-app\-name\fR, \fB\-\-no\-app\-name\fR" 2
.IX Item "--app-name, --no-app-name"
.Vb 1
\& Enable/disable APP.
.Ve
.SS "HEADER DISPLAY OPTIONS"
.IX Subsection "HEADER DISPLAY OPTIONS"
.IP \fB\-\-no\-inst\-info\fR 2
.IX Item "--no-inst-info"
.Vb 1
\& Hide instance information.
.Ve
.IP \fB\-\-no\-sys\-info\fR 2
.IX Item "--no-sys-info"
.Vb 1
\& Hide system information.
.Ve
.IP \fB\-\-no\-proc\-info\fR 2
.IX Item "--no-proc-info"
.Vb 1
\& Hide workers process information.
.Ve
.SS "OTHER DISPLAY OPTIONS"
.IX Subsection "OTHER DISPLAY OPTIONS"
.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\*(Aqs 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 TIME+, descending." 2
.IX Item "t Sort by TIME+, descending."
.IP "\fBy\fR Copy focused query to clipboard." 2
.IX Item "y Copy focused query to clipboard."
.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 "\fBUP / DOWN\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 "\fBUP / k\fR Move up the cursor." 2
.IX Item "UP / k Move up the cursor."
.PD 0
.IP "\fBDOWN / j\fR Move down the cursor." 2
.IX Item "DOWN / j Move down the cursor."
.IP "\fBPAGE UP\fR Move the cursor to the first line." 2
.IX Item "PAGE UP Move the cursor to the first line."
.IP "\fBPAGE DOWN\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 SUPERUSER 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 \fBHEADER\fR section and the \fBACTIVITY PANEL\fR
.PP
If a user doesn\*(Aqt have the CONNECT 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 PGDATA directory, the \fBsystem information HEADER\fR
group will not be displayed. The \fR\f(CB%CPU\fR\fB\fR, \fB\fR\f(CB%MEM\fR\fB\fR, \fBRead/s\fR and \fBWrite/s\fR
columns will also be missing from the \fBACTIVITY PANEL\fR.
.PP
On some OS like MacOS, psutil\*(Aqs \fBio_counters()\fR is not implemented. The effects
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 SUPERUSER
privilege, be a member of pg_read_server_files or have EXECUTE 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\*(Aqt provide the \fBpg_stat_get_wal_receiver()\fR function. Therefore
there is no wal receiver data in the \fBprocess & information HEADER\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=\*(Aqmypassword\*(Aq 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
|