mirror of
https://git.postgresql.org/git/postgresql.git
synced 2025-01-06 15:24:56 +08:00
Make pg_stat_activity.application_name visible to all users, rather than
being hidden when current_query is. Relocate it to a column position more consistent with that behavior. Per discussion.
This commit is contained in:
parent
42b2907d12
commit
0c61cff57a
@ -1,4 +1,4 @@
|
|||||||
<!-- $PostgreSQL: pgsql/doc/src/sgml/monitoring.sgml,v 1.72 2009/11/28 23:38:07 tgl Exp $ -->
|
<!-- $PostgreSQL: pgsql/doc/src/sgml/monitoring.sgml,v 1.73 2009/11/29 18:14:30 tgl Exp $ -->
|
||||||
|
|
||||||
<chapter id="monitoring">
|
<chapter id="monitoring">
|
||||||
<title>Monitoring Database Activity</title>
|
<title>Monitoring Database Activity</title>
|
||||||
@ -235,15 +235,15 @@ postgres: <replaceable>user</> <replaceable>database</> <replaceable>host</> <re
|
|||||||
<row>
|
<row>
|
||||||
<entry><structname>pg_stat_activity</></entry>
|
<entry><structname>pg_stat_activity</></entry>
|
||||||
<entry>One row per server process, showing database OID, database
|
<entry>One row per server process, showing database OID, database
|
||||||
name, process <acronym>ID</>, user OID, user name, current query,
|
name, process <acronym>ID</>, user OID, user name, application name,
|
||||||
query's waiting status, time at which the current transaction and
|
current query, query's waiting status, time at which the current
|
||||||
current query began execution, time at which the process was
|
transaction and current query began execution, time at which the
|
||||||
started, client's address and port number, and application name.
|
process was started, and client's address and port number.
|
||||||
The columns that report data on the current query are available unless
|
The columns that report data on the current query are available unless
|
||||||
the parameter <varname>track_activities</varname> has been turned off.
|
the parameter <varname>track_activities</varname> has been turned off.
|
||||||
Furthermore, these columns and the application name are only visible if
|
Furthermore, these columns are only visible if the user examining
|
||||||
the user examining the view is a superuser or the same as the user
|
the view is a superuser or the same as the user owning the process
|
||||||
owning the process being reported on.
|
being reported on.
|
||||||
</entry>
|
</entry>
|
||||||
</row>
|
</row>
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
* Copyright (c) 1996-2009, PostgreSQL Global Development Group
|
* Copyright (c) 1996-2009, PostgreSQL Global Development Group
|
||||||
*
|
*
|
||||||
* $PostgreSQL: pgsql/src/backend/catalog/system_views.sql,v 1.62 2009/11/28 23:38:07 tgl Exp $
|
* $PostgreSQL: pgsql/src/backend/catalog/system_views.sql,v 1.63 2009/11/29 18:14:30 tgl Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
CREATE VIEW pg_roles AS
|
CREATE VIEW pg_roles AS
|
||||||
@ -333,14 +333,14 @@ CREATE VIEW pg_stat_activity AS
|
|||||||
S.procpid,
|
S.procpid,
|
||||||
S.usesysid,
|
S.usesysid,
|
||||||
U.rolname AS usename,
|
U.rolname AS usename,
|
||||||
|
S.application_name,
|
||||||
S.current_query,
|
S.current_query,
|
||||||
S.waiting,
|
S.waiting,
|
||||||
S.xact_start,
|
S.xact_start,
|
||||||
S.query_start,
|
S.query_start,
|
||||||
S.backend_start,
|
S.backend_start,
|
||||||
S.client_addr,
|
S.client_addr,
|
||||||
S.client_port,
|
S.client_port
|
||||||
S.application_name
|
|
||||||
FROM pg_database D, pg_stat_get_activity(NULL) AS S, pg_authid U
|
FROM pg_database D, pg_stat_get_activity(NULL) AS S, pg_authid U
|
||||||
WHERE S.datid = D.oid AND
|
WHERE S.datid = D.oid AND
|
||||||
S.usesysid = U.oid;
|
S.usesysid = U.oid;
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/backend/utils/adt/pgstatfuncs.c,v 1.55 2009/11/28 23:38:07 tgl Exp $
|
* $PostgreSQL: pgsql/src/backend/utils/adt/pgstatfuncs.c,v 1.56 2009/11/29 18:14:30 tgl Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -420,14 +420,14 @@ pg_stat_get_activity(PG_FUNCTION_ARGS)
|
|||||||
TupleDescInitEntry(tupdesc, (AttrNumber) 1, "datid", OIDOID, -1, 0);
|
TupleDescInitEntry(tupdesc, (AttrNumber) 1, "datid", OIDOID, -1, 0);
|
||||||
TupleDescInitEntry(tupdesc, (AttrNumber) 2, "procpid", INT4OID, -1, 0);
|
TupleDescInitEntry(tupdesc, (AttrNumber) 2, "procpid", INT4OID, -1, 0);
|
||||||
TupleDescInitEntry(tupdesc, (AttrNumber) 3, "usesysid", OIDOID, -1, 0);
|
TupleDescInitEntry(tupdesc, (AttrNumber) 3, "usesysid", OIDOID, -1, 0);
|
||||||
TupleDescInitEntry(tupdesc, (AttrNumber) 4, "current_query", TEXTOID, -1, 0);
|
TupleDescInitEntry(tupdesc, (AttrNumber) 4, "application_name", TEXTOID, -1, 0);
|
||||||
TupleDescInitEntry(tupdesc, (AttrNumber) 5, "waiting", BOOLOID, -1, 0);
|
TupleDescInitEntry(tupdesc, (AttrNumber) 5, "current_query", TEXTOID, -1, 0);
|
||||||
TupleDescInitEntry(tupdesc, (AttrNumber) 6, "act_start", TIMESTAMPTZOID, -1, 0);
|
TupleDescInitEntry(tupdesc, (AttrNumber) 6, "waiting", BOOLOID, -1, 0);
|
||||||
TupleDescInitEntry(tupdesc, (AttrNumber) 7, "query_start", TIMESTAMPTZOID, -1, 0);
|
TupleDescInitEntry(tupdesc, (AttrNumber) 7, "act_start", TIMESTAMPTZOID, -1, 0);
|
||||||
TupleDescInitEntry(tupdesc, (AttrNumber) 8, "backend_start", TIMESTAMPTZOID, -1, 0);
|
TupleDescInitEntry(tupdesc, (AttrNumber) 8, "query_start", TIMESTAMPTZOID, -1, 0);
|
||||||
TupleDescInitEntry(tupdesc, (AttrNumber) 9, "client_addr", INETOID, -1, 0);
|
TupleDescInitEntry(tupdesc, (AttrNumber) 9, "backend_start", TIMESTAMPTZOID, -1, 0);
|
||||||
TupleDescInitEntry(tupdesc, (AttrNumber) 10, "client_port", INT4OID, -1, 0);
|
TupleDescInitEntry(tupdesc, (AttrNumber) 10, "client_addr", INETOID, -1, 0);
|
||||||
TupleDescInitEntry(tupdesc, (AttrNumber) 11, "application_name", TEXTOID, -1, 0);
|
TupleDescInitEntry(tupdesc, (AttrNumber) 11, "client_port", INT4OID, -1, 0);
|
||||||
|
|
||||||
funcctx->tuple_desc = BlessTupleDesc(tupdesc);
|
funcctx->tuple_desc = BlessTupleDesc(tupdesc);
|
||||||
|
|
||||||
@ -489,11 +489,15 @@ pg_stat_get_activity(PG_FUNCTION_ARGS)
|
|||||||
MemSet(nulls, 0, sizeof(nulls));
|
MemSet(nulls, 0, sizeof(nulls));
|
||||||
|
|
||||||
if (*(int *) (funcctx->user_fctx) > 0)
|
if (*(int *) (funcctx->user_fctx) > 0)
|
||||||
|
{
|
||||||
/* Get specific pid slot */
|
/* Get specific pid slot */
|
||||||
beentry = pgstat_fetch_stat_beentry(*(int *) (funcctx->user_fctx));
|
beentry = pgstat_fetch_stat_beentry(*(int *) (funcctx->user_fctx));
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
/* Get the next one in the list */
|
/* Get the next one in the list */
|
||||||
beentry = pgstat_fetch_stat_beentry(funcctx->call_cntr + 1); /* 1-based index */
|
beentry = pgstat_fetch_stat_beentry(funcctx->call_cntr + 1); /* 1-based index */
|
||||||
|
}
|
||||||
if (!beentry)
|
if (!beentry)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
@ -501,8 +505,8 @@ pg_stat_get_activity(PG_FUNCTION_ARGS)
|
|||||||
for (i = 0; i < sizeof(nulls) / sizeof(nulls[0]); i++)
|
for (i = 0; i < sizeof(nulls) / sizeof(nulls[0]); i++)
|
||||||
nulls[i] = true;
|
nulls[i] = true;
|
||||||
|
|
||||||
nulls[3] = false;
|
nulls[4] = false;
|
||||||
values[3] = CStringGetTextDatum("<backend information not available>");
|
values[4] = CStringGetTextDatum("<backend information not available>");
|
||||||
|
|
||||||
tuple = heap_form_tuple(funcctx->tuple_desc, values, nulls);
|
tuple = heap_form_tuple(funcctx->tuple_desc, values, nulls);
|
||||||
SRF_RETURN_NEXT(funcctx, HeapTupleGetDatum(tuple));
|
SRF_RETURN_NEXT(funcctx, HeapTupleGetDatum(tuple));
|
||||||
@ -512,43 +516,47 @@ pg_stat_get_activity(PG_FUNCTION_ARGS)
|
|||||||
values[0] = ObjectIdGetDatum(beentry->st_databaseid);
|
values[0] = ObjectIdGetDatum(beentry->st_databaseid);
|
||||||
values[1] = Int32GetDatum(beentry->st_procpid);
|
values[1] = Int32GetDatum(beentry->st_procpid);
|
||||||
values[2] = ObjectIdGetDatum(beentry->st_userid);
|
values[2] = ObjectIdGetDatum(beentry->st_userid);
|
||||||
|
if (beentry->st_appname)
|
||||||
|
values[3] = CStringGetTextDatum(beentry->st_appname);
|
||||||
|
else
|
||||||
|
nulls[3] = true;
|
||||||
|
|
||||||
/* Values only available to same user or superuser */
|
/* Values only available to same user or superuser */
|
||||||
if (superuser() || beentry->st_userid == GetUserId())
|
if (superuser() || beentry->st_userid == GetUserId())
|
||||||
{
|
{
|
||||||
if (*(beentry->st_activity) == '\0')
|
if (*(beentry->st_activity) == '\0')
|
||||||
{
|
{
|
||||||
values[3] = CStringGetTextDatum("<command string not enabled>");
|
values[4] = CStringGetTextDatum("<command string not enabled>");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
values[3] = CStringGetTextDatum(beentry->st_activity);
|
values[4] = CStringGetTextDatum(beentry->st_activity);
|
||||||
}
|
}
|
||||||
|
|
||||||
values[4] = BoolGetDatum(beentry->st_waiting);
|
values[5] = BoolGetDatum(beentry->st_waiting);
|
||||||
|
|
||||||
if (beentry->st_xact_start_timestamp != 0)
|
if (beentry->st_xact_start_timestamp != 0)
|
||||||
values[5] = TimestampTzGetDatum(beentry->st_xact_start_timestamp);
|
values[6] = TimestampTzGetDatum(beentry->st_xact_start_timestamp);
|
||||||
else
|
|
||||||
nulls[5] = true;
|
|
||||||
|
|
||||||
if (beentry->st_activity_start_timestamp != 0)
|
|
||||||
values[6] = TimestampTzGetDatum(beentry->st_activity_start_timestamp);
|
|
||||||
else
|
else
|
||||||
nulls[6] = true;
|
nulls[6] = true;
|
||||||
|
|
||||||
if (beentry->st_proc_start_timestamp != 0)
|
if (beentry->st_activity_start_timestamp != 0)
|
||||||
values[7] = TimestampTzGetDatum(beentry->st_proc_start_timestamp);
|
values[7] = TimestampTzGetDatum(beentry->st_activity_start_timestamp);
|
||||||
else
|
else
|
||||||
nulls[7] = true;
|
nulls[7] = true;
|
||||||
|
|
||||||
|
if (beentry->st_proc_start_timestamp != 0)
|
||||||
|
values[8] = TimestampTzGetDatum(beentry->st_proc_start_timestamp);
|
||||||
|
else
|
||||||
|
nulls[8] = true;
|
||||||
|
|
||||||
/* A zeroed client addr means we don't know */
|
/* A zeroed client addr means we don't know */
|
||||||
memset(&zero_clientaddr, 0, sizeof(zero_clientaddr));
|
memset(&zero_clientaddr, 0, sizeof(zero_clientaddr));
|
||||||
if (memcmp(&(beentry->st_clientaddr), &zero_clientaddr,
|
if (memcmp(&(beentry->st_clientaddr), &zero_clientaddr,
|
||||||
sizeof(zero_clientaddr) == 0))
|
sizeof(zero_clientaddr) == 0))
|
||||||
{
|
{
|
||||||
nulls[8] = true;
|
|
||||||
nulls[9] = true;
|
nulls[9] = true;
|
||||||
|
nulls[10] = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -571,15 +579,15 @@ pg_stat_get_activity(PG_FUNCTION_ARGS)
|
|||||||
NI_NUMERICHOST | NI_NUMERICSERV);
|
NI_NUMERICHOST | NI_NUMERICSERV);
|
||||||
if (ret)
|
if (ret)
|
||||||
{
|
{
|
||||||
nulls[8] = true;
|
|
||||||
nulls[9] = true;
|
nulls[9] = true;
|
||||||
|
nulls[10] = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
clean_ipv6_addr(beentry->st_clientaddr.addr.ss_family, remote_host);
|
clean_ipv6_addr(beentry->st_clientaddr.addr.ss_family, remote_host);
|
||||||
values[8] = DirectFunctionCall1(inet_in,
|
values[9] = DirectFunctionCall1(inet_in,
|
||||||
CStringGetDatum(remote_host));
|
CStringGetDatum(remote_host));
|
||||||
values[9] = Int32GetDatum(atoi(remote_port));
|
values[10] = Int32GetDatum(atoi(remote_port));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (beentry->st_clientaddr.addr.ss_family == AF_UNIX)
|
else if (beentry->st_clientaddr.addr.ss_family == AF_UNIX)
|
||||||
@ -590,28 +598,21 @@ pg_stat_get_activity(PG_FUNCTION_ARGS)
|
|||||||
* connections we have no permissions to view, or with
|
* connections we have no permissions to view, or with
|
||||||
* errors.
|
* errors.
|
||||||
*/
|
*/
|
||||||
nulls[8] = true;
|
nulls[9] = true;
|
||||||
values[9] = DatumGetInt32(-1);
|
values[10] = DatumGetInt32(-1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Unknown address type, should never happen */
|
/* Unknown address type, should never happen */
|
||||||
nulls[8] = true;
|
|
||||||
nulls[9] = true;
|
nulls[9] = true;
|
||||||
|
nulls[10] = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* application name */
|
|
||||||
if (beentry->st_appname)
|
|
||||||
values[10] = CStringGetTextDatum(beentry->st_appname);
|
|
||||||
else
|
|
||||||
nulls[10] = true;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* No permissions to view data about this session */
|
/* No permissions to view data about this session */
|
||||||
values[3] = CStringGetTextDatum("<insufficient privilege>");
|
values[4] = CStringGetTextDatum("<insufficient privilege>");
|
||||||
nulls[4] = true;
|
|
||||||
nulls[5] = true;
|
nulls[5] = true;
|
||||||
nulls[6] = true;
|
nulls[6] = true;
|
||||||
nulls[7] = true;
|
nulls[7] = true;
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
* Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
|
* Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
|
||||||
* Portions Copyright (c) 1994, Regents of the University of California
|
* Portions Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* $PostgreSQL: pgsql/src/include/catalog/catversion.h,v 1.553 2009/11/29 03:02:27 tgl Exp $
|
* $PostgreSQL: pgsql/src/include/catalog/catversion.h,v 1.554 2009/11/29 18:14:30 tgl Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -53,6 +53,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* yyyymmddN */
|
/* yyyymmddN */
|
||||||
#define CATALOG_VERSION_NO 200911282
|
#define CATALOG_VERSION_NO 200911291
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
* Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
|
* Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
|
||||||
* Portions Copyright (c) 1994, Regents of the University of California
|
* Portions Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* $PostgreSQL: pgsql/src/include/catalog/pg_proc.h,v 1.553 2009/11/28 23:38:07 tgl Exp $
|
* $PostgreSQL: pgsql/src/include/catalog/pg_proc.h,v 1.554 2009/11/29 18:14:30 tgl Exp $
|
||||||
*
|
*
|
||||||
* NOTES
|
* NOTES
|
||||||
* The script catalog/genbki.sh reads this file and generates .bki
|
* The script catalog/genbki.sh reads this file and generates .bki
|
||||||
@ -2999,7 +2999,7 @@ DATA(insert OID = 2784 ( pg_stat_get_last_autoanalyze_time PGNSP PGUID 12 1 0 0
|
|||||||
DESCR("statistics: last auto analyze time for a table");
|
DESCR("statistics: last auto analyze time for a table");
|
||||||
DATA(insert OID = 1936 ( pg_stat_get_backend_idset PGNSP PGUID 12 1 100 0 f f f t t s 0 0 23 "" _null_ _null_ _null_ _null_ pg_stat_get_backend_idset _null_ _null_ _null_ ));
|
DATA(insert OID = 1936 ( pg_stat_get_backend_idset PGNSP PGUID 12 1 100 0 f f f t t s 0 0 23 "" _null_ _null_ _null_ _null_ pg_stat_get_backend_idset _null_ _null_ _null_ ));
|
||||||
DESCR("statistics: currently active backend IDs");
|
DESCR("statistics: currently active backend IDs");
|
||||||
DATA(insert OID = 2022 ( pg_stat_get_activity PGNSP PGUID 12 1 100 0 f f f f t s 1 0 2249 "23" "{23,26,23,26,25,16,1184,1184,1184,869,23,25}" "{i,o,o,o,o,o,o,o,o,o,o,o}" "{pid,datid,procpid,usesysid,current_query,waiting,xact_start,query_start,backend_start,client_addr,client_port,application_name}" _null_ pg_stat_get_activity _null_ _null_ _null_ ));
|
DATA(insert OID = 2022 ( pg_stat_get_activity PGNSP PGUID 12 1 100 0 f f f f t s 1 0 2249 "23" "{23,26,23,26,25,25,16,1184,1184,1184,869,23}" "{i,o,o,o,o,o,o,o,o,o,o,o}" "{pid,datid,procpid,usesysid,application_name,current_query,waiting,xact_start,query_start,backend_start,client_addr,client_port}" _null_ pg_stat_get_activity _null_ _null_ _null_ ));
|
||||||
DESCR("statistics: information about currently active backends");
|
DESCR("statistics: information about currently active backends");
|
||||||
DATA(insert OID = 2026 ( pg_backend_pid PGNSP PGUID 12 1 0 0 f f f t f s 0 0 23 "" _null_ _null_ _null_ _null_ pg_backend_pid _null_ _null_ _null_ ));
|
DATA(insert OID = 2026 ( pg_backend_pid PGNSP PGUID 12 1 0 0 f f f t f s 0 0 23 "" _null_ _null_ _null_ _null_ pg_backend_pid _null_ _null_ _null_ ));
|
||||||
DESCR("statistics: current backend PID");
|
DESCR("statistics: current backend PID");
|
||||||
|
@ -1289,7 +1289,7 @@ SELECT viewname, definition FROM pg_views WHERE schemaname <> 'information_schem
|
|||||||
pg_rules | SELECT n.nspname AS schemaname, c.relname AS tablename, r.rulename, pg_get_ruledef(r.oid) AS definition FROM ((pg_rewrite r JOIN pg_class c ON ((c.oid = r.ev_class))) LEFT JOIN pg_namespace n ON ((n.oid = c.relnamespace))) WHERE (r.rulename <> '_RETURN'::name);
|
pg_rules | SELECT n.nspname AS schemaname, c.relname AS tablename, r.rulename, pg_get_ruledef(r.oid) AS definition FROM ((pg_rewrite r JOIN pg_class c ON ((c.oid = r.ev_class))) LEFT JOIN pg_namespace n ON ((n.oid = c.relnamespace))) WHERE (r.rulename <> '_RETURN'::name);
|
||||||
pg_settings | SELECT a.name, a.setting, a.unit, a.category, a.short_desc, a.extra_desc, a.context, a.vartype, a.source, a.min_val, a.max_val, a.enumvals, a.boot_val, a.reset_val, a.sourcefile, a.sourceline FROM pg_show_all_settings() a(name, setting, unit, category, short_desc, extra_desc, context, vartype, source, min_val, max_val, enumvals, boot_val, reset_val, sourcefile, sourceline);
|
pg_settings | SELECT a.name, a.setting, a.unit, a.category, a.short_desc, a.extra_desc, a.context, a.vartype, a.source, a.min_val, a.max_val, a.enumvals, a.boot_val, a.reset_val, a.sourcefile, a.sourceline FROM pg_show_all_settings() a(name, setting, unit, category, short_desc, extra_desc, context, vartype, source, min_val, max_val, enumvals, boot_val, reset_val, sourcefile, sourceline);
|
||||||
pg_shadow | SELECT pg_authid.rolname AS usename, pg_authid.oid AS usesysid, pg_authid.rolcreatedb AS usecreatedb, pg_authid.rolsuper AS usesuper, pg_authid.rolcatupdate AS usecatupd, pg_authid.rolpassword AS passwd, (pg_authid.rolvaliduntil)::abstime AS valuntil, s.setconfig AS useconfig FROM (pg_authid LEFT JOIN pg_db_role_setting s ON (((pg_authid.oid = s.setrole) AND (s.setdatabase = (0)::oid)))) WHERE pg_authid.rolcanlogin;
|
pg_shadow | SELECT pg_authid.rolname AS usename, pg_authid.oid AS usesysid, pg_authid.rolcreatedb AS usecreatedb, pg_authid.rolsuper AS usesuper, pg_authid.rolcatupdate AS usecatupd, pg_authid.rolpassword AS passwd, (pg_authid.rolvaliduntil)::abstime AS valuntil, s.setconfig AS useconfig FROM (pg_authid LEFT JOIN pg_db_role_setting s ON (((pg_authid.oid = s.setrole) AND (s.setdatabase = (0)::oid)))) WHERE pg_authid.rolcanlogin;
|
||||||
pg_stat_activity | SELECT s.datid, d.datname, s.procpid, s.usesysid, u.rolname AS usename, s.current_query, s.waiting, s.xact_start, s.query_start, s.backend_start, s.client_addr, s.client_port, s.application_name FROM pg_database d, pg_stat_get_activity(NULL::integer) s(datid, procpid, usesysid, current_query, waiting, xact_start, query_start, backend_start, client_addr, client_port, application_name), pg_authid u WHERE ((s.datid = d.oid) AND (s.usesysid = u.oid));
|
pg_stat_activity | SELECT s.datid, d.datname, s.procpid, s.usesysid, u.rolname AS usename, s.application_name, s.current_query, s.waiting, s.xact_start, s.query_start, s.backend_start, s.client_addr, s.client_port FROM pg_database d, pg_stat_get_activity(NULL::integer) s(datid, procpid, usesysid, application_name, current_query, waiting, xact_start, query_start, backend_start, client_addr, client_port), pg_authid u WHERE ((s.datid = d.oid) AND (s.usesysid = u.oid));
|
||||||
pg_stat_all_indexes | SELECT c.oid AS relid, i.oid AS indexrelid, n.nspname AS schemaname, c.relname, i.relname AS indexrelname, pg_stat_get_numscans(i.oid) AS idx_scan, pg_stat_get_tuples_returned(i.oid) AS idx_tup_read, pg_stat_get_tuples_fetched(i.oid) AS idx_tup_fetch FROM (((pg_class c JOIN pg_index x ON ((c.oid = x.indrelid))) JOIN pg_class i ON ((i.oid = x.indexrelid))) LEFT JOIN pg_namespace n ON ((n.oid = c.relnamespace))) WHERE (c.relkind = ANY (ARRAY['r'::"char", 't'::"char"]));
|
pg_stat_all_indexes | SELECT c.oid AS relid, i.oid AS indexrelid, n.nspname AS schemaname, c.relname, i.relname AS indexrelname, pg_stat_get_numscans(i.oid) AS idx_scan, pg_stat_get_tuples_returned(i.oid) AS idx_tup_read, pg_stat_get_tuples_fetched(i.oid) AS idx_tup_fetch FROM (((pg_class c JOIN pg_index x ON ((c.oid = x.indrelid))) JOIN pg_class i ON ((i.oid = x.indexrelid))) LEFT JOIN pg_namespace n ON ((n.oid = c.relnamespace))) WHERE (c.relkind = ANY (ARRAY['r'::"char", 't'::"char"]));
|
||||||
pg_stat_all_tables | SELECT c.oid AS relid, n.nspname AS schemaname, c.relname, pg_stat_get_numscans(c.oid) AS seq_scan, pg_stat_get_tuples_returned(c.oid) AS seq_tup_read, (sum(pg_stat_get_numscans(i.indexrelid)))::bigint AS idx_scan, ((sum(pg_stat_get_tuples_fetched(i.indexrelid)))::bigint + pg_stat_get_tuples_fetched(c.oid)) AS idx_tup_fetch, pg_stat_get_tuples_inserted(c.oid) AS n_tup_ins, pg_stat_get_tuples_updated(c.oid) AS n_tup_upd, pg_stat_get_tuples_deleted(c.oid) AS n_tup_del, pg_stat_get_tuples_hot_updated(c.oid) AS n_tup_hot_upd, pg_stat_get_live_tuples(c.oid) AS n_live_tup, pg_stat_get_dead_tuples(c.oid) AS n_dead_tup, pg_stat_get_last_vacuum_time(c.oid) AS last_vacuum, pg_stat_get_last_autovacuum_time(c.oid) AS last_autovacuum, pg_stat_get_last_analyze_time(c.oid) AS last_analyze, pg_stat_get_last_autoanalyze_time(c.oid) AS last_autoanalyze FROM ((pg_class c LEFT JOIN pg_index i ON ((c.oid = i.indrelid))) LEFT JOIN pg_namespace n ON ((n.oid = c.relnamespace))) WHERE (c.relkind = ANY (ARRAY['r'::"char", 't'::"char"])) GROUP BY c.oid, n.nspname, c.relname;
|
pg_stat_all_tables | SELECT c.oid AS relid, n.nspname AS schemaname, c.relname, pg_stat_get_numscans(c.oid) AS seq_scan, pg_stat_get_tuples_returned(c.oid) AS seq_tup_read, (sum(pg_stat_get_numscans(i.indexrelid)))::bigint AS idx_scan, ((sum(pg_stat_get_tuples_fetched(i.indexrelid)))::bigint + pg_stat_get_tuples_fetched(c.oid)) AS idx_tup_fetch, pg_stat_get_tuples_inserted(c.oid) AS n_tup_ins, pg_stat_get_tuples_updated(c.oid) AS n_tup_upd, pg_stat_get_tuples_deleted(c.oid) AS n_tup_del, pg_stat_get_tuples_hot_updated(c.oid) AS n_tup_hot_upd, pg_stat_get_live_tuples(c.oid) AS n_live_tup, pg_stat_get_dead_tuples(c.oid) AS n_dead_tup, pg_stat_get_last_vacuum_time(c.oid) AS last_vacuum, pg_stat_get_last_autovacuum_time(c.oid) AS last_autovacuum, pg_stat_get_last_analyze_time(c.oid) AS last_analyze, pg_stat_get_last_autoanalyze_time(c.oid) AS last_autoanalyze FROM ((pg_class c LEFT JOIN pg_index i ON ((c.oid = i.indrelid))) LEFT JOIN pg_namespace n ON ((n.oid = c.relnamespace))) WHERE (c.relkind = ANY (ARRAY['r'::"char", 't'::"char"])) GROUP BY c.oid, n.nspname, c.relname;
|
||||||
pg_stat_bgwriter | SELECT pg_stat_get_bgwriter_timed_checkpoints() AS checkpoints_timed, pg_stat_get_bgwriter_requested_checkpoints() AS checkpoints_req, pg_stat_get_bgwriter_buf_written_checkpoints() AS buffers_checkpoint, pg_stat_get_bgwriter_buf_written_clean() AS buffers_clean, pg_stat_get_bgwriter_maxwritten_clean() AS maxwritten_clean, pg_stat_get_buf_written_backend() AS buffers_backend, pg_stat_get_buf_alloc() AS buffers_alloc;
|
pg_stat_bgwriter | SELECT pg_stat_get_bgwriter_timed_checkpoints() AS checkpoints_timed, pg_stat_get_bgwriter_requested_checkpoints() AS checkpoints_req, pg_stat_get_bgwriter_buf_written_checkpoints() AS buffers_checkpoint, pg_stat_get_bgwriter_buf_written_clean() AS buffers_clean, pg_stat_get_bgwriter_maxwritten_clean() AS maxwritten_clean, pg_stat_get_buf_written_backend() AS buffers_backend, pg_stat_get_buf_alloc() AS buffers_alloc;
|
||||||
|
Loading…
Reference in New Issue
Block a user