Activity
René Samselnig edited this page Sep 3, 2015
·
1 revision
Lists the statements and transactions currently active in the given DBMS.
Table of Contents
- Uses PostgreSQL's feature of the statement activity
- Returned statements can be optionally filtered by query, pids, and states
- Currently PostgreSQL only
usage: dbstac [-h] [--version] [--trace] [--debug] [--info] [--warning]
[--error] [--critical] [-L LOGFILE] [-D] [-u USERNAME] [-p PIDS]
[-s STATES] [-a] [-v]
uri [pattern]
Lists the statements and transactions currently active in the DBMS.
positional arguments:
uri the URI to a DBMS
pattern shows only queries that match the pattern (default: no
pattern)
optional arguments:
-h, --help show this help message and exit
--version show program's version number and exit
-u USERNAME, --username USERNAME
filter the user
-p PIDS, --pids PIDS filter the process ids of the activity; multiple
columns can be specified by separating them with a
comma
-s STATES, --states STATES
filter the states of the activity; multiple columns
can be specified by separating them with a comma
-a, --all show all activity, even those with insufficient
privileges
-v, --verbose specify the verbosity of the output, increase the
number of occurences of this option to increase
verbosity
logging:
--trace set loglevel to trace
--debug set loglevel to debug
--info set loglevel to info
--warning set loglevel to warning
--error set loglevel to error
--critical set loglevel to critical
-L LOGFILE, --logfile LOGFILE
the file to log to
formatters:
-D, --default output format: default
Contact:
If you experience bugs or want to request new features please visit
<https://github.com/resamsel/dbnavigator/issues>
dbstac user@localhost/database
8420 active 0:00:00.000650 select sa.datname database_name, sa.pid pid, sa.usename username, coalesce(sa.client_addr || ':' || sa.client_port, '') as client, sa.xact_start transaction_start, sa.query_start query_start, sa.state state, regexp_replace(sa.query, '\s+', ' ', 'g') query, sa.waiting blocked, case when sa.waiting then string_agg(l.virtualxid, ',') else '' end blocked_by, now() - sa.xact_start as transaction_duration, now() - sa.query_start as query_duration from pg_stat_activity sa left join pg_locks l on l.pid = sa.pid where 'skiline' in (sa.datname, '') and ( sa.state in ('') or array[''] = array[''] ) and (sa.state != 'disabled' or False) and '' in (sa.usename, '') and ( sa.pid in (-1) or array[-1] = array[-1] ) and ( '' = '' or sa.query like '%%'