diff options
| author | Tom Lane | 2010-08-08 16:27:06 +0000 |
|---|---|---|
| committer | Tom Lane | 2010-08-08 16:27:06 +0000 |
| commit | 46aa77c7bd256b3448cc420e02ff59d7cc0270c1 (patch) | |
| tree | cdf372525292dbd9290d69f3e94a5de010b4a108 /src/include | |
| parent | 83f5491c63f33cce5b84532cd76602295580809e (diff) | |
Add stats functions and views to provide access to a transaction's own
statistics counts. These numbers are being accumulated but haven't yet been
transmitted to the collector (and won't be, until the transaction ends).
For some purposes, though, it's handy to be able to look at them.
Joel Jacobson, reviewed by Itagaki Takahiro
Diffstat (limited to 'src/include')
| -rw-r--r-- | src/include/catalog/catversion.h | 4 | ||||
| -rw-r--r-- | src/include/catalog/pg_proc.h | 27 | ||||
| -rw-r--r-- | src/include/pgstat.h | 5 |
3 files changed, 32 insertions, 4 deletions
diff --git a/src/include/catalog/catversion.h b/src/include/catalog/catversion.h index 6e498ba104..1decb54a99 100644 --- a/src/include/catalog/catversion.h +++ b/src/include/catalog/catversion.h @@ -37,7 +37,7 @@ * Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/catalog/catversion.h,v 1.591 2010/08/07 02:44:07 tgl Exp $ + * $PostgreSQL: pgsql/src/include/catalog/catversion.h,v 1.592 2010/08/08 16:27:04 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -53,6 +53,6 @@ */ /* yyyymmddN */ -#define CATALOG_VERSION_NO 201008061 +#define CATALOG_VERSION_NO 201008071 #endif diff --git a/src/include/catalog/pg_proc.h b/src/include/catalog/pg_proc.h index ffea7c9b57..bb8215c8fa 100644 --- a/src/include/catalog/pg_proc.h +++ b/src/include/catalog/pg_proc.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/catalog/pg_proc.h,v 1.575 2010/08/05 18:21:17 tgl Exp $ + * $PostgreSQL: pgsql/src/include/catalog/pg_proc.h,v 1.576 2010/08/08 16:27:04 tgl Exp $ * * NOTES * The script catalog/genbki.pl reads this file and generates .bki @@ -3093,6 +3093,31 @@ 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 = 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"); +DATA(insert OID = 3038 ( pg_stat_get_xact_tuples_returned PGNSP PGUID 12 1 0 0 f f f t f v 1 0 20 "26" _null_ _null_ _null_ _null_ pg_stat_get_xact_tuples_returned _null_ _null_ _null_ )); +DESCR("statistics: number of tuples read by seqscan in current transaction"); +DATA(insert OID = 3039 ( pg_stat_get_xact_tuples_fetched PGNSP PGUID 12 1 0 0 f f f t f v 1 0 20 "26" _null_ _null_ _null_ _null_ pg_stat_get_xact_tuples_fetched _null_ _null_ _null_ )); +DESCR("statistics: number of tuples fetched by idxscan in current transaction"); +DATA(insert OID = 3040 ( pg_stat_get_xact_tuples_inserted PGNSP PGUID 12 1 0 0 f f f t f v 1 0 20 "26" _null_ _null_ _null_ _null_ pg_stat_get_xact_tuples_inserted _null_ _null_ _null_ )); +DESCR("statistics: number of tuples inserted in current transaction"); +DATA(insert OID = 3041 ( pg_stat_get_xact_tuples_updated PGNSP PGUID 12 1 0 0 f f f t f v 1 0 20 "26" _null_ _null_ _null_ _null_ pg_stat_get_xact_tuples_updated _null_ _null_ _null_ )); +DESCR("statistics: number of tuples updated in current transaction"); +DATA(insert OID = 3042 ( pg_stat_get_xact_tuples_deleted PGNSP PGUID 12 1 0 0 f f f t f v 1 0 20 "26" _null_ _null_ _null_ _null_ pg_stat_get_xact_tuples_deleted _null_ _null_ _null_ )); +DESCR("statistics: number of tuples deleted in current transaction"); +DATA(insert OID = 3043 ( pg_stat_get_xact_tuples_hot_updated PGNSP PGUID 12 1 0 0 f f f t f v 1 0 20 "26" _null_ _null_ _null_ _null_ pg_stat_get_xact_tuples_hot_updated _null_ _null_ _null_ )); +DESCR("statistics: number of tuples hot updated in current transaction"); +DATA(insert OID = 3044 ( pg_stat_get_xact_blocks_fetched PGNSP PGUID 12 1 0 0 f f f t f v 1 0 20 "26" _null_ _null_ _null_ _null_ pg_stat_get_xact_blocks_fetched _null_ _null_ _null_ )); +DESCR("statistics: number of blocks fetched in current transaction"); +DATA(insert OID = 3045 ( pg_stat_get_xact_blocks_hit PGNSP PGUID 12 1 0 0 f f f t f v 1 0 20 "26" _null_ _null_ _null_ _null_ pg_stat_get_xact_blocks_hit _null_ _null_ _null_ )); +DESCR("statistics: number of blocks found in cache in current transaction"); +DATA(insert OID = 3046 ( pg_stat_get_xact_function_calls PGNSP PGUID 12 1 0 0 f f f t f v 1 0 20 "26" _null_ _null_ _null_ _null_ pg_stat_get_xact_function_calls _null_ _null_ _null_ )); +DESCR("statistics: number of function calls in current transaction"); +DATA(insert OID = 3047 ( pg_stat_get_xact_function_time PGNSP PGUID 12 1 0 0 f f f t f v 1 0 20 "26" _null_ _null_ _null_ _null_ pg_stat_get_xact_function_time _null_ _null_ _null_ )); +DESCR("statistics: execution time of function in current transaction"); +DATA(insert OID = 3048 ( pg_stat_get_xact_function_self_time PGNSP PGUID 12 1 0 0 f f f t f v 1 0 20 "26" _null_ _null_ _null_ _null_ pg_stat_get_xact_function_self_time _null_ _null_ _null_ )); +DESCR("statistics: self execution time of function in current transaction"); + DATA(insert OID = 2230 ( pg_stat_clear_snapshot PGNSP PGUID 12 1 0 0 f f f f f v 0 0 2278 "" _null_ _null_ _null_ _null_ pg_stat_clear_snapshot _null_ _null_ _null_ )); DESCR("statistics: discard current transaction's statistics snapshot"); DATA(insert OID = 2274 ( pg_stat_reset PGNSP PGUID 12 1 0 0 f f f f f v 0 0 2278 "" _null_ _null_ _null_ _null_ pg_stat_reset _null_ _null_ _null_ )); diff --git a/src/include/pgstat.h b/src/include/pgstat.h index 34577fa55b..fae6cb8155 100644 --- a/src/include/pgstat.h +++ b/src/include/pgstat.h @@ -5,7 +5,7 @@ * * Copyright (c) 2001-2010, PostgreSQL Global Development Group * - * $PostgreSQL: pgsql/src/include/pgstat.h,v 1.89 2010/02/26 02:01:20 momjian Exp $ + * $PostgreSQL: pgsql/src/include/pgstat.h,v 1.90 2010/08/08 16:27:06 tgl Exp $ * ---------- */ #ifndef PGSTAT_H @@ -692,6 +692,9 @@ extern void pgstat_report_xact_timestamp(TimestampTz tstamp); extern void pgstat_report_waiting(bool waiting); extern const char *pgstat_get_backend_current_activity(int pid, bool checkUser); +extern PgStat_TableStatus *find_tabstat_entry(Oid rel_id); +extern PgStat_BackendFunctionEntry *find_funcstat_entry(Oid func_id); + extern void pgstat_initstats(Relation rel); /* nontransactional event counts are simple enough to inline */ |
