mirror of
https://git.postgresql.org/git/postgresql.git
synced 2025-01-06 15:24:56 +08:00
Show xid and xmin in pg_stat_activity and pg_stat_replication.
Christian Kruse, reviewed by Andres Freund and myself, with further minor adjustments by me.
This commit is contained in:
parent
278c94209b
commit
dd1a3bccca
@ -628,6 +628,16 @@ postgres: <replaceable>user</> <replaceable>database</> <replaceable>host</> <re
|
|||||||
</itemizedlist>
|
</itemizedlist>
|
||||||
</entry>
|
</entry>
|
||||||
</row>
|
</row>
|
||||||
|
<row>
|
||||||
|
<entry><structfield>backend_xid</structfield></entry>
|
||||||
|
<entry><type>xid</type></entry>
|
||||||
|
<entry>Toplevel transaction identifier of this backend, if any.</entry>
|
||||||
|
</row>
|
||||||
|
<row>
|
||||||
|
<entry><structfield>backend_xmin</structfield></entry>
|
||||||
|
<entry><type>xid</type></entry>
|
||||||
|
<entry>The current backend's <literal>xmin</> horizon.</entry>
|
||||||
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry><structfield>query</></entry>
|
<entry><structfield>query</></entry>
|
||||||
<entry><type>text</></entry>
|
<entry><type>text</></entry>
|
||||||
@ -1483,6 +1493,12 @@ postgres: <replaceable>user</> <replaceable>database</> <replaceable>host</> <re
|
|||||||
client connected to this WAL sender
|
client connected to this WAL sender
|
||||||
</entry>
|
</entry>
|
||||||
</row>
|
</row>
|
||||||
|
<row>
|
||||||
|
<entry><structfield>backend_xid</structfield></entry>
|
||||||
|
<entry><type>xid</type></entry>
|
||||||
|
<entry>This standby's <literal>xmin</> horizon reported
|
||||||
|
by <xref linkend="guc-hot-standby-feedback">.</entry>
|
||||||
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry><structfield>state</></entry>
|
<entry><structfield>state</></entry>
|
||||||
<entry><type>text</></entry>
|
<entry><type>text</></entry>
|
||||||
|
@ -586,6 +586,8 @@ CREATE VIEW pg_stat_activity AS
|
|||||||
S.state_change,
|
S.state_change,
|
||||||
S.waiting,
|
S.waiting,
|
||||||
S.state,
|
S.state,
|
||||||
|
S.backend_xid,
|
||||||
|
s.backend_xmin,
|
||||||
S.query
|
S.query
|
||||||
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
|
||||||
@ -601,6 +603,7 @@ CREATE VIEW pg_stat_replication AS
|
|||||||
S.client_hostname,
|
S.client_hostname,
|
||||||
S.client_port,
|
S.client_port,
|
||||||
S.backend_start,
|
S.backend_start,
|
||||||
|
S.backend_xmin,
|
||||||
W.state,
|
W.state,
|
||||||
W.sent_location,
|
W.sent_location,
|
||||||
W.write_location,
|
W.write_location,
|
||||||
|
@ -48,12 +48,14 @@
|
|||||||
#include "postmaster/autovacuum.h"
|
#include "postmaster/autovacuum.h"
|
||||||
#include "postmaster/fork_process.h"
|
#include "postmaster/fork_process.h"
|
||||||
#include "postmaster/postmaster.h"
|
#include "postmaster/postmaster.h"
|
||||||
|
#include "storage/proc.h"
|
||||||
#include "storage/backendid.h"
|
#include "storage/backendid.h"
|
||||||
#include "storage/fd.h"
|
#include "storage/fd.h"
|
||||||
#include "storage/ipc.h"
|
#include "storage/ipc.h"
|
||||||
#include "storage/latch.h"
|
#include "storage/latch.h"
|
||||||
#include "storage/pg_shmem.h"
|
#include "storage/pg_shmem.h"
|
||||||
#include "storage/procsignal.h"
|
#include "storage/procsignal.h"
|
||||||
|
#include "storage/sinvaladt.h"
|
||||||
#include "utils/ascii.h"
|
#include "utils/ascii.h"
|
||||||
#include "utils/guc.h"
|
#include "utils/guc.h"
|
||||||
#include "utils/memutils.h"
|
#include "utils/memutils.h"
|
||||||
@ -213,7 +215,7 @@ typedef struct TwoPhasePgStatRecord
|
|||||||
*/
|
*/
|
||||||
static MemoryContext pgStatLocalContext = NULL;
|
static MemoryContext pgStatLocalContext = NULL;
|
||||||
static HTAB *pgStatDBHash = NULL;
|
static HTAB *pgStatDBHash = NULL;
|
||||||
static PgBackendStatus *localBackendStatusTable = NULL;
|
static LocalPgBackendStatus *localBackendStatusTable = NULL;
|
||||||
static int localNumBackends = 0;
|
static int localNumBackends = 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -2303,6 +2305,28 @@ pgstat_fetch_stat_beentry(int beid)
|
|||||||
{
|
{
|
||||||
pgstat_read_current_status();
|
pgstat_read_current_status();
|
||||||
|
|
||||||
|
if (beid < 1 || beid > localNumBackends)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
return &localBackendStatusTable[beid - 1].backendStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* ----------
|
||||||
|
* pgstat_fetch_stat_local_beentry() -
|
||||||
|
*
|
||||||
|
* Like pgstat_fetch_stat_beentry() but with locally computed addtions (like
|
||||||
|
* xid and xmin values of the backend)
|
||||||
|
*
|
||||||
|
* NB: caller is responsible for a check if the user is permitted to see
|
||||||
|
* this info (especially the querystring).
|
||||||
|
* ----------
|
||||||
|
*/
|
||||||
|
LocalPgBackendStatus *
|
||||||
|
pgstat_fetch_stat_local_beentry(int beid)
|
||||||
|
{
|
||||||
|
pgstat_read_current_status();
|
||||||
|
|
||||||
if (beid < 1 || beid > localNumBackends)
|
if (beid < 1 || beid > localNumBackends)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
@ -2783,8 +2807,8 @@ static void
|
|||||||
pgstat_read_current_status(void)
|
pgstat_read_current_status(void)
|
||||||
{
|
{
|
||||||
volatile PgBackendStatus *beentry;
|
volatile PgBackendStatus *beentry;
|
||||||
PgBackendStatus *localtable;
|
LocalPgBackendStatus *localtable;
|
||||||
PgBackendStatus *localentry;
|
LocalPgBackendStatus *localentry;
|
||||||
char *localappname,
|
char *localappname,
|
||||||
*localactivity;
|
*localactivity;
|
||||||
int i;
|
int i;
|
||||||
@ -2795,9 +2819,9 @@ pgstat_read_current_status(void)
|
|||||||
|
|
||||||
pgstat_setup_memcxt();
|
pgstat_setup_memcxt();
|
||||||
|
|
||||||
localtable = (PgBackendStatus *)
|
localtable = (LocalPgBackendStatus *)
|
||||||
MemoryContextAlloc(pgStatLocalContext,
|
MemoryContextAlloc(pgStatLocalContext,
|
||||||
sizeof(PgBackendStatus) * MaxBackends);
|
sizeof(LocalPgBackendStatus) * MaxBackends);
|
||||||
localappname = (char *)
|
localappname = (char *)
|
||||||
MemoryContextAlloc(pgStatLocalContext,
|
MemoryContextAlloc(pgStatLocalContext,
|
||||||
NAMEDATALEN * MaxBackends);
|
NAMEDATALEN * MaxBackends);
|
||||||
@ -2821,19 +2845,19 @@ pgstat_read_current_status(void)
|
|||||||
{
|
{
|
||||||
int save_changecount = beentry->st_changecount;
|
int save_changecount = beentry->st_changecount;
|
||||||
|
|
||||||
localentry->st_procpid = beentry->st_procpid;
|
localentry->backendStatus.st_procpid = beentry->st_procpid;
|
||||||
if (localentry->st_procpid > 0)
|
if (localentry->backendStatus.st_procpid > 0)
|
||||||
{
|
{
|
||||||
memcpy(localentry, (char *) beentry, sizeof(PgBackendStatus));
|
memcpy(&localentry->backendStatus, (char *) beentry, sizeof(PgBackendStatus));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* strcpy is safe even if the string is modified concurrently,
|
* strcpy is safe even if the string is modified concurrently,
|
||||||
* because there's always a \0 at the end of the buffer.
|
* because there's always a \0 at the end of the buffer.
|
||||||
*/
|
*/
|
||||||
strcpy(localappname, (char *) beentry->st_appname);
|
strcpy(localappname, (char *) beentry->st_appname);
|
||||||
localentry->st_appname = localappname;
|
localentry->backendStatus.st_appname = localappname;
|
||||||
strcpy(localactivity, (char *) beentry->st_activity);
|
strcpy(localactivity, (char *) beentry->st_activity);
|
||||||
localentry->st_activity = localactivity;
|
localentry->backendStatus.st_activity = localactivity;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (save_changecount == beentry->st_changecount &&
|
if (save_changecount == beentry->st_changecount &&
|
||||||
@ -2846,8 +2870,12 @@ pgstat_read_current_status(void)
|
|||||||
|
|
||||||
beentry++;
|
beentry++;
|
||||||
/* Only valid entries get included into the local array */
|
/* Only valid entries get included into the local array */
|
||||||
if (localentry->st_procpid > 0)
|
if (localentry->backendStatus.st_procpid > 0)
|
||||||
{
|
{
|
||||||
|
BackendIdGetTransactionIds(i,
|
||||||
|
&localentry->backend_xid,
|
||||||
|
&localentry->backend_xmin);
|
||||||
|
|
||||||
localentry++;
|
localentry++;
|
||||||
localappname += NAMEDATALEN;
|
localappname += NAMEDATALEN;
|
||||||
localactivity += pgstat_track_activity_query_size;
|
localactivity += pgstat_track_activity_query_size;
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
#include "storage/shmem.h"
|
#include "storage/shmem.h"
|
||||||
#include "storage/sinvaladt.h"
|
#include "storage/sinvaladt.h"
|
||||||
#include "storage/spin.h"
|
#include "storage/spin.h"
|
||||||
|
#include "access/transam.h"
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -400,6 +401,37 @@ BackendIdGetProc(int backendID)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* BackendIdGetTransactionIds
|
||||||
|
* Get the xid and xmin of the backend. The result may be out of date
|
||||||
|
* arbitrarily quickly, so the caller must be careful about how this
|
||||||
|
* information is used.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
BackendIdGetTransactionIds(int backendID, TransactionId *xid, TransactionId *xmin)
|
||||||
|
{
|
||||||
|
ProcState *stateP;
|
||||||
|
SISeg *segP = shmInvalBuffer;
|
||||||
|
PGXACT *xact;
|
||||||
|
|
||||||
|
*xid = InvalidTransactionId;
|
||||||
|
*xmin = InvalidTransactionId;
|
||||||
|
|
||||||
|
/* Need to lock out additions/removals of backends */
|
||||||
|
LWLockAcquire(SInvalWriteLock, LW_SHARED);
|
||||||
|
|
||||||
|
if (backendID > 0 && backendID <= segP->lastBackend)
|
||||||
|
{
|
||||||
|
stateP = &segP->procState[backendID - 1];
|
||||||
|
xact = &ProcGlobal->allPgXact[stateP->proc->pgprocno];
|
||||||
|
|
||||||
|
*xid = xact->xid;
|
||||||
|
*xmin = xact->xmin;
|
||||||
|
}
|
||||||
|
|
||||||
|
LWLockRelease(SInvalWriteLock);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* SIInsertDataEntries
|
* SIInsertDataEntries
|
||||||
* Add new invalidation message(s) to the buffer.
|
* Add new invalidation message(s) to the buffer.
|
||||||
|
@ -536,7 +536,7 @@ pg_stat_get_activity(PG_FUNCTION_ARGS)
|
|||||||
|
|
||||||
oldcontext = MemoryContextSwitchTo(funcctx->multi_call_memory_ctx);
|
oldcontext = MemoryContextSwitchTo(funcctx->multi_call_memory_ctx);
|
||||||
|
|
||||||
tupdesc = CreateTemplateTupleDesc(14, false);
|
tupdesc = CreateTemplateTupleDesc(16, false);
|
||||||
TupleDescInitEntry(tupdesc, (AttrNumber) 1, "datid",
|
TupleDescInitEntry(tupdesc, (AttrNumber) 1, "datid",
|
||||||
OIDOID, -1, 0);
|
OIDOID, -1, 0);
|
||||||
TupleDescInitEntry(tupdesc, (AttrNumber) 2, "pid",
|
TupleDescInitEntry(tupdesc, (AttrNumber) 2, "pid",
|
||||||
@ -565,6 +565,10 @@ pg_stat_get_activity(PG_FUNCTION_ARGS)
|
|||||||
TEXTOID, -1, 0);
|
TEXTOID, -1, 0);
|
||||||
TupleDescInitEntry(tupdesc, (AttrNumber) 14, "client_port",
|
TupleDescInitEntry(tupdesc, (AttrNumber) 14, "client_port",
|
||||||
INT4OID, -1, 0);
|
INT4OID, -1, 0);
|
||||||
|
TupleDescInitEntry(tupdesc, (AttrNumber) 15, "backend_xid",
|
||||||
|
XIDOID, -1, 0);
|
||||||
|
TupleDescInitEntry(tupdesc, (AttrNumber) 16, "backend_xmin",
|
||||||
|
XIDOID, -1, 0);
|
||||||
|
|
||||||
funcctx->tuple_desc = BlessTupleDesc(tupdesc);
|
funcctx->tuple_desc = BlessTupleDesc(tupdesc);
|
||||||
|
|
||||||
@ -616,9 +620,10 @@ pg_stat_get_activity(PG_FUNCTION_ARGS)
|
|||||||
if (funcctx->call_cntr < funcctx->max_calls)
|
if (funcctx->call_cntr < funcctx->max_calls)
|
||||||
{
|
{
|
||||||
/* for each row */
|
/* for each row */
|
||||||
Datum values[14];
|
Datum values[16];
|
||||||
bool nulls[14];
|
bool nulls[16];
|
||||||
HeapTuple tuple;
|
HeapTuple tuple;
|
||||||
|
LocalPgBackendStatus *local_beentry;
|
||||||
PgBackendStatus *beentry;
|
PgBackendStatus *beentry;
|
||||||
|
|
||||||
MemSet(values, 0, sizeof(values));
|
MemSet(values, 0, sizeof(values));
|
||||||
@ -627,12 +632,14 @@ pg_stat_get_activity(PG_FUNCTION_ARGS)
|
|||||||
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));
|
local_beentry = pgstat_fetch_stat_local_beentry(*(int *) (funcctx->user_fctx));
|
||||||
|
beentry = &local_beentry->backendStatus;
|
||||||
}
|
}
|
||||||
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 */
|
local_beentry = pgstat_fetch_stat_local_beentry(funcctx->call_cntr + 1); /* 1-based index */
|
||||||
|
beentry = &local_beentry->backendStatus;
|
||||||
}
|
}
|
||||||
if (!beentry)
|
if (!beentry)
|
||||||
{
|
{
|
||||||
@ -657,6 +664,16 @@ pg_stat_get_activity(PG_FUNCTION_ARGS)
|
|||||||
else
|
else
|
||||||
nulls[3] = true;
|
nulls[3] = true;
|
||||||
|
|
||||||
|
if (TransactionIdIsValid(local_beentry->backend_xid))
|
||||||
|
values[14] = TransactionIdGetDatum(local_beentry->backend_xid);
|
||||||
|
else
|
||||||
|
nulls[14] = true;
|
||||||
|
|
||||||
|
if (TransactionIdIsValid(local_beentry->backend_xmin))
|
||||||
|
values[15] = TransactionIdGetDatum(local_beentry->backend_xmin);
|
||||||
|
else
|
||||||
|
nulls[15] = 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())
|
||||||
{
|
{
|
||||||
|
@ -53,6 +53,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* yyyymmddN */
|
/* yyyymmddN */
|
||||||
#define CATALOG_VERSION_NO 201402241
|
#define CATALOG_VERSION_NO 201402251
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -2632,7 +2632,7 @@ DATA(insert OID = 3057 ( pg_stat_get_autoanalyze_count PGNSP PGUID 12 1 0 0 0 f
|
|||||||
DESCR("statistics: number of auto analyzes for a table");
|
DESCR("statistics: number of auto analyzes for a table");
|
||||||
DATA(insert OID = 1936 ( pg_stat_get_backend_idset PGNSP PGUID 12 1 100 0 0 f 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 0 f 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 0 f f f f f t s 1 0 2249 "23" "{23,26,23,26,25,25,25,16,1184,1184,1184,1184,869,25,23}" "{i,o,o,o,o,o,o,o,o,o,o,o,o,o,o}" "{pid,datid,pid,usesysid,application_name,state,query,waiting,xact_start,query_start,backend_start,state_change,client_addr,client_hostname,client_port}" _null_ pg_stat_get_activity _null_ _null_ _null_ ));
|
DATA(insert OID = 2022 ( pg_stat_get_activity PGNSP PGUID 12 1 100 0 0 f f f f f t s 1 0 2249 "23" "{23,26,23,26,25,25,25,16,1184,1184,1184,1184,869,25,23,28,28}" "{i,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o}" "{pid,datid,pid,usesysid,application_name,state,query,waiting,xact_start,query_start,backend_start,state_change,client_addr,client_hostname,client_port,backend_xid,backend_xmin}" _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 = 3099 ( pg_stat_get_wal_senders PGNSP PGUID 12 1 10 0 0 f f f f f t s 0 0 2249 "" "{23,25,3220,3220,3220,3220,23,25}" "{o,o,o,o,o,o,o,o}" "{pid,state,sent_location,write_location,flush_location,replay_location,sync_priority,sync_state}" _null_ pg_stat_get_wal_senders _null_ _null_ _null_ ));
|
DATA(insert OID = 3099 ( pg_stat_get_wal_senders PGNSP PGUID 12 1 10 0 0 f f f f f t s 0 0 2249 "" "{23,25,3220,3220,3220,3220,23,25}" "{o,o,o,o,o,o,o,o}" "{pid,state,sent_location,write_location,flush_location,replay_location,sync_priority,sync_state}" _null_ pg_stat_get_wal_senders _null_ _null_ _null_ ));
|
||||||
DESCR("statistics: information about currently active replication");
|
DESCR("statistics: information about currently active replication");
|
||||||
|
@ -735,6 +735,34 @@ typedef struct PgBackendStatus
|
|||||||
char *st_activity;
|
char *st_activity;
|
||||||
} PgBackendStatus;
|
} PgBackendStatus;
|
||||||
|
|
||||||
|
/* ----------
|
||||||
|
* LocalPgBackendStatus
|
||||||
|
*
|
||||||
|
* When we build the backend status array, we use LocalPgBackendStatus to be
|
||||||
|
* able to add new values to the struct when needed without adding new fields
|
||||||
|
* to the shared memory. It contains the backend status as a first member.
|
||||||
|
* ----------
|
||||||
|
*/
|
||||||
|
typedef struct LocalPgBackendStatus
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* Local version of the backend status entry.
|
||||||
|
*/
|
||||||
|
PgBackendStatus backendStatus;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The xid of the current transaction if available, InvalidTransactionId
|
||||||
|
* if not.
|
||||||
|
*/
|
||||||
|
TransactionId backend_xid;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The xmin of the current session if available, InvalidTransactionId
|
||||||
|
* if not.
|
||||||
|
*/
|
||||||
|
TransactionId backend_xmin;
|
||||||
|
} LocalPgBackendStatus;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Working state needed to accumulate per-function-call timing statistics.
|
* Working state needed to accumulate per-function-call timing statistics.
|
||||||
*/
|
*/
|
||||||
@ -907,6 +935,7 @@ extern void pgstat_send_bgwriter(void);
|
|||||||
extern PgStat_StatDBEntry *pgstat_fetch_stat_dbentry(Oid dbid);
|
extern PgStat_StatDBEntry *pgstat_fetch_stat_dbentry(Oid dbid);
|
||||||
extern PgStat_StatTabEntry *pgstat_fetch_stat_tabentry(Oid relid);
|
extern PgStat_StatTabEntry *pgstat_fetch_stat_tabentry(Oid relid);
|
||||||
extern PgBackendStatus *pgstat_fetch_stat_beentry(int beid);
|
extern PgBackendStatus *pgstat_fetch_stat_beentry(int beid);
|
||||||
|
extern LocalPgBackendStatus *pgstat_fetch_stat_local_beentry(int beid);
|
||||||
extern PgStat_StatFuncEntry *pgstat_fetch_stat_funcentry(Oid funcid);
|
extern PgStat_StatFuncEntry *pgstat_fetch_stat_funcentry(Oid funcid);
|
||||||
extern int pgstat_fetch_stat_numbackends(void);
|
extern int pgstat_fetch_stat_numbackends(void);
|
||||||
extern PgStat_ArchiverStats *pgstat_fetch_stat_archiver(void);
|
extern PgStat_ArchiverStats *pgstat_fetch_stat_archiver(void);
|
||||||
|
@ -32,6 +32,7 @@ extern Size SInvalShmemSize(void);
|
|||||||
extern void CreateSharedInvalidationState(void);
|
extern void CreateSharedInvalidationState(void);
|
||||||
extern void SharedInvalBackendInit(bool sendOnly);
|
extern void SharedInvalBackendInit(bool sendOnly);
|
||||||
extern PGPROC *BackendIdGetProc(int backendID);
|
extern PGPROC *BackendIdGetProc(int backendID);
|
||||||
|
extern void BackendIdGetTransactionIds(int backendID, TransactionId *xid, TransactionId *xmin);
|
||||||
|
|
||||||
extern void SIInsertDataEntries(const SharedInvalidationMessage *data, int n);
|
extern void SIInsertDataEntries(const SharedInvalidationMessage *data, int n);
|
||||||
extern int SIGetDataEntries(SharedInvalidationMessage *data, int datasize);
|
extern int SIGetDataEntries(SharedInvalidationMessage *data, int datasize);
|
||||||
|
@ -1604,9 +1604,11 @@ pg_stat_activity| SELECT s.datid,
|
|||||||
s.state_change,
|
s.state_change,
|
||||||
s.waiting,
|
s.waiting,
|
||||||
s.state,
|
s.state,
|
||||||
|
s.backend_xid,
|
||||||
|
s.backend_xmin,
|
||||||
s.query
|
s.query
|
||||||
FROM pg_database d,
|
FROM pg_database d,
|
||||||
pg_stat_get_activity(NULL::integer) s(datid, pid, usesysid, application_name, state, query, waiting, xact_start, query_start, backend_start, state_change, client_addr, client_hostname, client_port),
|
pg_stat_get_activity(NULL::integer) s(datid, pid, usesysid, application_name, state, query, waiting, xact_start, query_start, backend_start, state_change, client_addr, client_hostname, client_port, backend_xid, backend_xmin),
|
||||||
pg_authid u
|
pg_authid u
|
||||||
WHERE ((s.datid = d.oid) AND (s.usesysid = u.oid));
|
WHERE ((s.datid = d.oid) AND (s.usesysid = u.oid));
|
||||||
pg_stat_all_indexes| SELECT c.oid AS relid,
|
pg_stat_all_indexes| SELECT c.oid AS relid,
|
||||||
@ -1704,6 +1706,7 @@ pg_stat_replication| SELECT s.pid,
|
|||||||
s.client_hostname,
|
s.client_hostname,
|
||||||
s.client_port,
|
s.client_port,
|
||||||
s.backend_start,
|
s.backend_start,
|
||||||
|
s.backend_xmin,
|
||||||
w.state,
|
w.state,
|
||||||
w.sent_location,
|
w.sent_location,
|
||||||
w.write_location,
|
w.write_location,
|
||||||
@ -1711,7 +1714,7 @@ pg_stat_replication| SELECT s.pid,
|
|||||||
w.replay_location,
|
w.replay_location,
|
||||||
w.sync_priority,
|
w.sync_priority,
|
||||||
w.sync_state
|
w.sync_state
|
||||||
FROM pg_stat_get_activity(NULL::integer) s(datid, pid, usesysid, application_name, state, query, waiting, xact_start, query_start, backend_start, state_change, client_addr, client_hostname, client_port),
|
FROM pg_stat_get_activity(NULL::integer) s(datid, pid, usesysid, application_name, state, query, waiting, xact_start, query_start, backend_start, state_change, client_addr, client_hostname, client_port, backend_xid, backend_xmin),
|
||||||
pg_authid u,
|
pg_authid u,
|
||||||
pg_stat_get_wal_senders() w(pid, state, sent_location, write_location, flush_location, replay_location, sync_priority, sync_state)
|
pg_stat_get_wal_senders() w(pid, state, sent_location, write_location, flush_location, replay_location, sync_priority, sync_state)
|
||||||
WHERE ((s.usesysid = u.oid) AND (s.pid = w.pid));
|
WHERE ((s.usesysid = u.oid) AND (s.pid = w.pid));
|
||||||
|
Loading…
Reference in New Issue
Block a user