Dne 12.12.2010 03:47, Robert Haas napsal(a):
> On Sat, Dec 11, 2010 at 4:40 PM, <[email protected]> wrote:
>>> Hello
>>>
>>> you have to respect pg coding style:
>>>
>>> a) not too long lines
>>> b) not C++ line comments
>>
>> OK, thanks for the notice. I've fixed those two problems.
>
> Please add this to the currently-open commitfest.
>
> https://commitfest.postgresql.org/action/commitfest_view/open
I've done several small changes to the patch, namely
- added docs for the functions (in SGML)
- added the same thing for background writer
So I think now it's 'complete' and I'll add it to the commit fest in a
few minutes.
regards
Tomas
diff --git a/doc/src/sgml/monitoring.sgml b/doc/src/sgml/monitoring.sgml
index 5fd0213..40c6c6b 100644
--- a/doc/src/sgml/monitoring.sgml
+++ b/doc/src/sgml/monitoring.sgml
@@ -600,6 +600,15 @@ postgres: <replaceable>user</> <replaceable>database</>
<replaceable>host</> <re
</row>
<row>
+
<entry><literal><function>pg_stat_get_db_last_stat_reset_time</function>(<type>oid</type>)</literal></entry>
+ <entry><type>timestamptz</type></entry>
+ <entry>
+ Time of the last reset of statistics for this database (as a result of
executing
+ <function>pg_stat_reset</function> function)
+ </entry>
+ </row>
+
+ <row>
<entry><literal><function>pg_stat_get_numscans</function>(<type>oid</type>)</literal></entry>
<entry><type>bigint</type></entry>
<entry>
@@ -725,6 +734,15 @@ postgres: <replaceable>user</> <replaceable>database</>
<replaceable>host</> <re
</row>
<row>
+
<entry><literal><function>pg_stat_get_last_stat_reset_time</function>(<type>oid</type>)</literal></entry>
+ <entry><type>timestamptz</type></entry>
+ <entry>
+ Time of the last reset of statistics on this table (as a result of
executing
+ <function>pg_stat_reset</function> or
<function>pg_stat_reset_single_table_counters</function>)
+ </entry>
+ </row>
+
+ <row>
<entry><literal><function>pg_stat_get_vacuum_count</function>(<type>oid</type>)</literal></entry>
<entry><type>bigint</type></entry>
<entry>
@@ -879,6 +897,15 @@ postgres: <replaceable>user</> <replaceable>database</>
<replaceable>host</> <re
</row>
<row>
+
<entry><literal><function>pg_stat_get_function_last_stat_reset_time</function>(<type>oid</type>)</literal></entry>
+ <entry><type>timestamptz</type></entry>
+ <entry>
+ Time of the last reset of statistics for this function (as a result of
executing
+ <function>pg_stat_reset</function> or
<function>pg_stat_reset_single_function_counters</function>)
+ </entry>
+ </row>
+
+ <row>
<entry><literal><function>pg_stat_get_xact_function_calls</function>(<type>oid</type>)</literal></entry>
<entry><type>bigint</type></entry>
<entry>
@@ -1064,6 +1091,15 @@ postgres: <replaceable>user</> <replaceable>database</>
<replaceable>host</> <re
</row>
<row>
+
<entry><literal><function>pg_stat_get_bgwriter_last_stat_reset_time()</function></literal></entry>
+ <entry><type>timestamptz</type></entry>
+ <entry>
+ Time of the last reset of statistics for the background writer (as a
result of executing
+ <function>pg_stat_reset_shared('bgwriter')</function>)
+ </entry>
+ </row>
+
+ <row>
<entry><literal><function>pg_stat_get_buf_written_backend()</function></literal></entry>
<entry><type>bigint</type></entry>
<entry>
diff --git a/src/backend/catalog/system_views.sql
b/src/backend/catalog/system_views.sql
index 346eaaf..3e1cca3 100644
--- a/src/backend/catalog/system_views.sql
+++ b/src/backend/catalog/system_views.sql
@@ -310,6 +310,7 @@ CREATE VIEW pg_stat_all_tables AS
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,
+ pg_stat_get_last_stat_reset_time(C.oid) as last_stat_reset,
pg_stat_get_vacuum_count(C.oid) AS vacuum_count,
pg_stat_get_autovacuum_count(C.oid) AS autovacuum_count,
pg_stat_get_analyze_count(C.oid) AS analyze_count,
@@ -502,7 +503,8 @@ CREATE VIEW pg_stat_database AS
pg_stat_get_db_tuples_fetched(D.oid) AS tup_fetched,
pg_stat_get_db_tuples_inserted(D.oid) AS tup_inserted,
pg_stat_get_db_tuples_updated(D.oid) AS tup_updated,
- pg_stat_get_db_tuples_deleted(D.oid) AS tup_deleted
+ pg_stat_get_db_tuples_deleted(D.oid) AS tup_deleted,
+ pg_stat_get_db_last_stat_reset_time(D.oid) AS last_stat_reset
FROM pg_database D;
CREATE VIEW pg_stat_user_functions AS
@@ -512,7 +514,8 @@ CREATE VIEW pg_stat_user_functions AS
P.proname AS funcname,
pg_stat_get_function_calls(P.oid) AS calls,
pg_stat_get_function_time(P.oid) / 1000 AS total_time,
- pg_stat_get_function_self_time(P.oid) / 1000 AS self_time
+ pg_stat_get_function_self_time(P.oid) / 1000 AS self_time,
+ pg_stat_get_function_last_stat_reset_time(P.oid) AS last_stat_reset
FROM pg_proc P LEFT JOIN pg_namespace N ON (N.oid = P.pronamespace)
WHERE P.prolang != 12 -- fast check to eliminate built-in functions
AND pg_stat_get_function_calls(P.oid) IS NOT NULL;
@@ -538,7 +541,8 @@ CREATE VIEW pg_stat_bgwriter AS
pg_stat_get_bgwriter_maxwritten_clean() AS maxwritten_clean,
pg_stat_get_buf_written_backend() AS buffers_backend,
pg_stat_get_buf_fsync_backend() AS buffers_backend_fsync,
- pg_stat_get_buf_alloc() AS buffers_alloc;
+ pg_stat_get_buf_alloc() AS buffers_alloc,
+ pg_stat_get_bgwriter_last_stat_reset_time() AS last_stat_reset;
CREATE VIEW pg_user_mappings AS
SELECT
diff --git a/src/backend/postmaster/pgstat.c b/src/backend/postmaster/pgstat.c
index c3c136a..1fd5e6a 100644
--- a/src/backend/postmaster/pgstat.c
+++ b/src/backend/postmaster/pgstat.c
@@ -249,6 +249,8 @@ static void pgstat_sighup_handler(SIGNAL_ARGS);
static PgStat_StatDBEntry *pgstat_get_db_entry(Oid databaseid, bool create);
static PgStat_StatTabEntry *pgstat_get_tab_entry(PgStat_StatDBEntry *dbentry,
Oid tableoid, bool create);
+static PgStat_StatFuncEntry *pgstat_get_func_entry(PgStat_StatDBEntry *dbentry,
+ Oid funcoid, bool create);
static void pgstat_write_statsfile(bool permanent);
static HTAB *pgstat_read_statsfile(Oid onlydb, bool permanent);
static void backend_read_statsfile(void);
@@ -3129,7 +3131,9 @@ pgstat_get_db_entry(Oid databaseid, bool create)
result->n_tuples_updated = 0;
result->n_tuples_deleted = 0;
result->last_autovac_time = 0;
-
+
+ result->stat_reset_timestamp = GetCurrentTimestamp();
+
memset(&hash_ctl, 0, sizeof(hash_ctl));
hash_ctl.keysize = sizeof(Oid);
hash_ctl.entrysize = sizeof(PgStat_StatTabEntry);
@@ -3196,11 +3200,48 @@ pgstat_get_tab_entry(PgStat_StatDBEntry *dbentry, Oid
tableoid, bool create)
result->autovac_vacuum_count = 0;
result->analyze_count = 0;
result->autovac_analyze_count = 0;
+
+ /* inherit stat time reset from dbentry */
+ result->stat_reset_timestamp = dbentry->stat_reset_timestamp;
+
}
return result;
}
+/*
+ * Lookup the hash table entry for the specified function. If no hash
+ * table entry exists, initialize it, if the create parameter is true.
+ * Else, return NULL.
+ */
+static PgStat_StatFuncEntry *
+pgstat_get_func_entry(PgStat_StatDBEntry *dbentry, Oid tableoid, bool create)
+{
+ PgStat_StatFuncEntry *result;
+ bool found;
+ HASHACTION action = (create ? HASH_ENTER : HASH_FIND);
+
+ /* Lookup or create the hash table entry for this table */
+ result = (PgStat_StatFuncEntry *) hash_search(dbentry->functions,
+
&tableoid,
+
action, &found);
+
+ if (!create && !found)
+ return NULL;
+
+ /* If not found, initialize the new one. */
+ if (!found)
+ {
+ result->f_numcalls = 0;
+ result->f_time = 0;
+ result->f_time_self = 0;
+
+ /* inherit stat time reset from dbentry */
+ result->stat_reset_timestamp = dbentry->stat_reset_timestamp;
+ }
+
+ return result;
+}
/* ----------
* pgstat_write_statsfile() -
@@ -3408,6 +3449,12 @@ pgstat_read_statsfile(Oid onlydb, bool permanent)
* load an existing statsfile.
*/
memset(&globalStats, 0, sizeof(globalStats));
+
+ /*
+ * Set the current timestamp (will be kept only in case we can't load an
+ * existing statsfile.
+ */
+ globalStats.stat_reset_timestamp = GetCurrentTimestamp();
/*
* Try to open the status file. If it doesn't exist, the backends simply
@@ -3867,6 +3914,8 @@ pgstat_recv_tabstat(PgStat_MsgTabstat *msg, int len)
tabentry->autovac_vacuum_timestamp = 0;
tabentry->analyze_timestamp = 0;
tabentry->autovac_analyze_timestamp = 0;
+
+ tabentry->stat_reset_timestamp =
dbentry->stat_reset_timestamp;
}
else
{
@@ -4010,6 +4059,8 @@ pgstat_recv_resetcounter(PgStat_MsgResetcounter *msg, int
len)
dbentry->n_xact_rollback = 0;
dbentry->n_blocks_fetched = 0;
dbentry->n_blocks_hit = 0;
+
+ dbentry->stat_reset_timestamp = GetCurrentTimestamp();
memset(&hash_ctl, 0, sizeof(hash_ctl));
hash_ctl.keysize = sizeof(Oid);
@@ -4042,6 +4093,7 @@
pgstat_recv_resetsharedcounter(PgStat_MsgResetsharedcounter *msg, int len)
{
/* Reset the global background writer statistics for the
cluster. */
memset(&globalStats, 0, sizeof(globalStats));
+ globalStats.stat_reset_timestamp = GetCurrentTimestamp();
}
/*
@@ -4060,6 +4112,8 @@ static void
pgstat_recv_resetsinglecounter(PgStat_MsgResetsinglecounter *msg, int len)
{
PgStat_StatDBEntry *dbentry;
+ PgStat_StatTabEntry *tabentry;
+ PgStat_StatFuncEntry *funcentry;
dbentry = pgstat_get_db_entry(msg->m_databaseid, false);
@@ -4069,9 +4123,29 @@
pgstat_recv_resetsinglecounter(PgStat_MsgResetsinglecounter *msg, int len)
/* Remove object if it exists, ignore it if not */
if (msg->m_resettype == RESET_TABLE)
+ {
(void) hash_search(dbentry->tables, (void *)
&(msg->m_objectid), HASH_REMOVE, NULL);
+
+ /*
+ * need to create it, so that I can set current timestamp
(otherwise it would
+ * be inherited from the database entry)
+ */
+ tabentry = pgstat_get_tab_entry(dbentry, msg->m_objectid, true);
+ tabentry->stat_reset_timestamp = GetCurrentTimestamp();
+
+ }
else if (msg->m_resettype == RESET_FUNCTION)
+ {
(void) hash_search(dbentry->functions, (void *)
&(msg->m_objectid), HASH_REMOVE, NULL);
+
+ /*
+ * need to create it, so that I can set current timestamp
(otherwise it would
+ * be inherited from the database entry)
+ */
+ funcentry = pgstat_get_func_entry(dbentry, msg->m_objectid,
true);
+ funcentry->stat_reset_timestamp = GetCurrentTimestamp();
+
+ }
}
/* ----------
@@ -4227,6 +4301,9 @@ pgstat_recv_funcstat(PgStat_MsgFuncstat *msg, int len)
funcentry->f_numcalls = funcmsg->f_numcalls;
funcentry->f_time = funcmsg->f_time;
funcentry->f_time_self = funcmsg->f_time_self;
+
+ funcentry->stat_reset_timestamp =
dbentry->stat_reset_timestamp;
+
}
else
{
diff --git a/src/backend/utils/adt/pgstatfuncs.c
b/src/backend/utils/adt/pgstatfuncs.c
index adab948..cd3291b 100644
--- a/src/backend/utils/adt/pgstatfuncs.c
+++ b/src/backend/utils/adt/pgstatfuncs.c
@@ -38,6 +38,7 @@ extern Datum pg_stat_get_last_vacuum_time(PG_FUNCTION_ARGS);
extern Datum pg_stat_get_last_autovacuum_time(PG_FUNCTION_ARGS);
extern Datum pg_stat_get_last_analyze_time(PG_FUNCTION_ARGS);
extern Datum pg_stat_get_last_autoanalyze_time(PG_FUNCTION_ARGS);
+extern Datum pg_stat_get_last_stat_reset_time(PG_FUNCTION_ARGS);
extern Datum pg_stat_get_vacuum_count(PG_FUNCTION_ARGS);
extern Datum pg_stat_get_autovacuum_count(PG_FUNCTION_ARGS);
extern Datum pg_stat_get_analyze_count(PG_FUNCTION_ARGS);
@@ -46,6 +47,7 @@ extern Datum pg_stat_get_autoanalyze_count(PG_FUNCTION_ARGS);
extern Datum pg_stat_get_function_calls(PG_FUNCTION_ARGS);
extern Datum pg_stat_get_function_time(PG_FUNCTION_ARGS);
extern Datum pg_stat_get_function_self_time(PG_FUNCTION_ARGS);
+extern Datum pg_stat_get_function_last_stat_reset_time(PG_FUNCTION_ARGS);
extern Datum pg_stat_get_backend_idset(PG_FUNCTION_ARGS);
extern Datum pg_stat_get_activity(PG_FUNCTION_ARGS);
@@ -71,12 +73,14 @@ extern Datum
pg_stat_get_db_tuples_fetched(PG_FUNCTION_ARGS);
extern Datum pg_stat_get_db_tuples_inserted(PG_FUNCTION_ARGS);
extern Datum pg_stat_get_db_tuples_updated(PG_FUNCTION_ARGS);
extern Datum pg_stat_get_db_tuples_deleted(PG_FUNCTION_ARGS);
+extern Datum pg_stat_get_db_last_stat_reset_time(PG_FUNCTION_ARGS);
extern Datum pg_stat_get_bgwriter_timed_checkpoints(PG_FUNCTION_ARGS);
extern Datum pg_stat_get_bgwriter_requested_checkpoints(PG_FUNCTION_ARGS);
extern Datum pg_stat_get_bgwriter_buf_written_checkpoints(PG_FUNCTION_ARGS);
extern Datum pg_stat_get_bgwriter_buf_written_clean(PG_FUNCTION_ARGS);
extern Datum pg_stat_get_bgwriter_maxwritten_clean(PG_FUNCTION_ARGS);
+extern Datum pg_stat_get_bgwriter_last_stat_reset_time(PG_FUNCTION_ARGS);
extern Datum pg_stat_get_buf_written_backend(PG_FUNCTION_ARGS);
extern Datum pg_stat_get_buf_fsync_backend(PG_FUNCTION_ARGS);
extern Datum pg_stat_get_buf_alloc(PG_FUNCTION_ARGS);
@@ -352,6 +356,24 @@ pg_stat_get_last_autoanalyze_time(PG_FUNCTION_ARGS)
}
Datum
+pg_stat_get_last_stat_reset_time(PG_FUNCTION_ARGS)
+{
+ Oid relid = PG_GETARG_OID(0);
+ TimestampTz result;
+ PgStat_StatTabEntry *tabentry;
+
+ if ((tabentry = pgstat_fetch_stat_tabentry(relid)) == NULL)
+ result = 0;
+ else
+ result = tabentry->stat_reset_timestamp;
+
+ if (result == 0)
+ PG_RETURN_NULL();
+ else
+ PG_RETURN_TIMESTAMPTZ(result);
+}
+
+Datum
pg_stat_get_vacuum_count(PG_FUNCTION_ARGS)
{
Oid relid = PG_GETARG_OID(0);
@@ -445,6 +467,24 @@ pg_stat_get_function_self_time(PG_FUNCTION_ARGS)
}
Datum
+pg_stat_get_function_last_stat_reset_time(PG_FUNCTION_ARGS)
+{
+ Oid funcid = PG_GETARG_OID(0);
+ TimestampTz result;
+ PgStat_StatFuncEntry *funcentry;
+
+ if ((funcentry = pgstat_fetch_stat_funcentry(funcid)) == NULL)
+ result = 0;
+ else
+ result = funcentry->stat_reset_timestamp;
+
+ if (result == 0)
+ PG_RETURN_NULL();
+ else
+ PG_RETURN_TIMESTAMPTZ(result);
+}
+
+Datum
pg_stat_get_backend_idset(PG_FUNCTION_ARGS)
{
FuncCallContext *funcctx;
@@ -1130,6 +1170,24 @@ pg_stat_get_db_tuples_deleted(PG_FUNCTION_ARGS)
}
Datum
+pg_stat_get_db_last_stat_reset_time(PG_FUNCTION_ARGS)
+{
+ Oid dbid = PG_GETARG_OID(0);
+ TimestampTz result;
+ PgStat_StatDBEntry *dbentry;
+
+ if ((dbentry = pgstat_fetch_stat_dbentry(dbid)) == NULL)
+ result = 0;
+ else
+ result = dbentry->stat_reset_timestamp;
+
+ if (result == 0)
+ PG_RETURN_NULL();
+ else
+ PG_RETURN_TIMESTAMPTZ(result);
+}
+
+Datum
pg_stat_get_bgwriter_timed_checkpoints(PG_FUNCTION_ARGS)
{
PG_RETURN_INT64(pgstat_fetch_global()->timed_checkpoints);
@@ -1160,6 +1218,12 @@ pg_stat_get_bgwriter_maxwritten_clean(PG_FUNCTION_ARGS)
}
Datum
+pg_stat_get_bgwriter_last_stat_reset_time(PG_FUNCTION_ARGS)
+{
+ PG_RETURN_TIMESTAMPTZ(pgstat_fetch_global()->stat_reset_timestamp);
+}
+
+Datum
pg_stat_get_buf_written_backend(PG_FUNCTION_ARGS)
{
PG_RETURN_INT64(pgstat_fetch_global()->buf_written_backend);
diff --git a/src/include/catalog/pg_proc.h b/src/include/catalog/pg_proc.h
index feae22e..9a5ebba 100644
--- a/src/include/catalog/pg_proc.h
+++ b/src/include/catalog/pg_proc.h
@@ -3055,6 +3055,8 @@ DATA(insert OID = 2783 ( pg_stat_get_last_analyze_time
PGNSP PGUID 12 1 0 0 f f
DESCR("statistics: last manual analyze time for a table");
DATA(insert OID = 2784 ( pg_stat_get_last_autoanalyze_time PGNSP PGUID 12 1 0
0 f f f t f s 1 0 1184 "26" _null_ _null_ _null_ _null_
pg_stat_get_last_autoanalyze_time _null_ _null_ _null_ ));
DESCR("statistics: last auto analyze time for a table");
+DATA(insert OID = 3115 ( pg_stat_get_last_stat_reset_time PGNSP PGUID 12 1 0
0 f f f t f s 1 0 1184 "26" _null_ _null_ _null_ _null_
pg_stat_get_last_stat_reset_time _null_ _null_ _null_ ));
+DESCR("statistics: last reset for a table");
DATA(insert OID = 3054 ( pg_stat_get_vacuum_count PGNSP PGUID 12 1 0 0 f f f t
f s 1 0 20 "26" _null_ _null_ _null_ _null_ pg_stat_get_vacuum_count _null_
_null_ _null_ ));
DESCR("statistics: number of manual vacuums for a table");
DATA(insert OID = 3055 ( pg_stat_get_autovacuum_count PGNSP PGUID 12 1 0 0 f f
f t f s 1 0 20 "26" _null_ _null_ _null_ _null_ pg_stat_get_autovacuum_count
_null_ _null_ _null_ ));
@@ -3109,6 +3111,8 @@ DATA(insert OID = 2761 ( pg_stat_get_db_tuples_updated
PGNSP PGUID 12 1 0 0 f f
DESCR("statistics: tuples updated in database");
DATA(insert OID = 2762 ( pg_stat_get_db_tuples_deleted PGNSP PGUID 12 1 0 0 f
f f t f s 1 0 20 "26" _null_ _null_ _null_ _null_ pg_stat_get_db_tuples_deleted
_null_ _null_ _null_ ));
DESCR("statistics: tuples deleted in database");
+DATA(insert OID = 3116 ( pg_stat_get_db_last_stat_reset_time PGNSP PGUID 12 1
0 0 f f f t f s 1 0 1184 "26" _null_ _null_ _null_ _null_
pg_stat_get_db_last_stat_reset_time _null_ _null_ _null_ ));
+DESCR("statistics: last reset for a database");
DATA(insert OID = 2769 ( pg_stat_get_bgwriter_timed_checkpoints PGNSP PGUID 12
1 0 0 f f f t f s 0 0 20 "" _null_ _null_ _null_ _null_
pg_stat_get_bgwriter_timed_checkpoints _null_ _null_ _null_ ));
DESCR("statistics: number of timed checkpoints started by the bgwriter");
DATA(insert OID = 2770 ( pg_stat_get_bgwriter_requested_checkpoints PGNSP
PGUID 12 1 0 0 f f f t f s 0 0 20 "" _null_ _null_ _null_ _null_
pg_stat_get_bgwriter_requested_checkpoints _null_ _null_ _null_ ));
@@ -3119,6 +3123,8 @@ DATA(insert OID = 2772 (
pg_stat_get_bgwriter_buf_written_clean PGNSP PGUID 12 1
DESCR("statistics: number of buffers written by the bgwriter for cleaning
dirty buffers");
DATA(insert OID = 2773 ( pg_stat_get_bgwriter_maxwritten_clean PGNSP PGUID 12
1 0 0 f f f t f s 0 0 20 "" _null_ _null_ _null_ _null_
pg_stat_get_bgwriter_maxwritten_clean _null_ _null_ _null_ ));
DESCR("statistics: number of times the bgwriter stopped processing when it had
written too many buffers while cleaning");
+DATA(insert OID = 3118 ( pg_stat_get_bgwriter_last_stat_reset_time PGNSP PGUID
12 1 0 0 f f f t f s 0 0 1184 "" _null_ _null_ _null_ _null_
pg_stat_get_bgwriter_last_stat_reset_time _null_ _null_ _null_ ));
+DESCR("statistics: last reset for the bgwriter");
DATA(insert OID = 2775 ( pg_stat_get_buf_written_backend PGNSP PGUID 12 1 0 0
f f f t f s 0 0 20 "" _null_ _null_ _null_ _null_
pg_stat_get_buf_written_backend _null_ _null_ _null_ ));
DESCR("statistics: number of buffers written by backends");
DATA(insert OID = 3063 ( pg_stat_get_buf_fsync_backend PGNSP PGUID 12 1 0 0 f
f f t f s 0 0 20 "" _null_ _null_ _null_ _null_ pg_stat_get_buf_fsync_backend
_null_ _null_ _null_ ));
@@ -3132,6 +3138,8 @@ DATA(insert OID = 2979 ( pg_stat_get_function_time
PGNSP PGUID 12 1 0 0 f f f
DESCR("statistics: execution time of function");
DATA(insert OID = 2980 ( pg_stat_get_function_self_time PGNSP PGUID 12
1 0 0 f f f t f s 1 0 20 "26" _null_ _null_ _null_ _null_
pg_stat_get_function_self_time _null_ _null_ _null_ ));
DESCR("statistics: self execution time of function");
+DATA(insert OID = 3117 ( pg_stat_get_function_last_stat_reset_time PGNSP
PGUID 12 1 0 0 f f f t f s 1 0 1184 "26" _null_ _null_ _null_ _null_
pg_stat_get_function_last_stat_reset_time _null_ _null_ _null_ ));
+DESCR("statistics: last reset for a function");
DATA(insert OID = 3037 ( pg_stat_get_xact_numscans
PGNSP PGUID 12 1 0 0 f f f t f v 1 0 20 "26" _null_ _null_ _null_ _null_
pg_stat_get_xact_numscans _null_ _null_ _null_ ));
DESCR("statistics: number of scans done for table/index in current
transaction");
diff --git a/src/include/pgstat.h b/src/include/pgstat.h
index 42bf9c4..3b00cbe 100644
--- a/src/include/pgstat.h
+++ b/src/include/pgstat.h
@@ -490,6 +490,7 @@ typedef struct PgStat_StatDBEntry
PgStat_Counter n_tuples_updated;
PgStat_Counter n_tuples_deleted;
TimestampTz last_autovac_time;
+ TimestampTz stat_reset_timestamp;
/*
* tables and functions must be last in the struct, because we don't
write
@@ -533,6 +534,9 @@ typedef struct PgStat_StatTabEntry
PgStat_Counter analyze_count;
TimestampTz autovac_analyze_timestamp; /* autovacuum initiated
*/
PgStat_Counter autovac_analyze_count;
+
+ TimestampTz stat_reset_timestamp;
+
} PgStat_StatTabEntry;
@@ -548,6 +552,9 @@ typedef struct PgStat_StatFuncEntry
PgStat_Counter f_time; /* times in microseconds */
PgStat_Counter f_time_self;
+
+ TimestampTz stat_reset_timestamp;
+
} PgStat_StatFuncEntry;
@@ -565,6 +572,8 @@ typedef struct PgStat_GlobalStats
PgStat_Counter buf_written_backend;
PgStat_Counter buf_fsync_backend;
PgStat_Counter buf_alloc;
+ TimestampTz stat_reset_timestamp;
+
} PgStat_GlobalStats;
--
Sent via pgsql-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers