diff options
| author | Tom Lane | 2012-04-30 18:02:47 +0000 |
|---|---|---|
| committer | Tom Lane | 2012-04-30 18:03:33 +0000 |
| commit | 809e7e21af8cd24855f1802524a13bbaa823f929 (patch) | |
| tree | 450387adf177bd65f21de4c29d6428852608a8b4 /src/include | |
| parent | 26471a51fc833e2ce58a2f16f891256d57dd28c6 (diff) | |
Converge all SQL-level statistics timing values to float8 milliseconds.
This patch adjusts the core statistics views to match the decision already
taken for pg_stat_statements, that values representing elapsed time should
be represented as float8 and measured in milliseconds. By using float8,
we are no longer tied to a specific maximum precision of timing data.
(Internally, it's still microseconds, but we could now change that without
needing changes at the SQL level.)
The columns affected are
pg_stat_bgwriter.checkpoint_write_time
pg_stat_bgwriter.checkpoint_sync_time
pg_stat_database.blk_read_time
pg_stat_database.blk_write_time
pg_stat_user_functions.total_time
pg_stat_user_functions.self_time
pg_stat_xact_user_functions.total_time
pg_stat_xact_user_functions.self_time
The first four of these are new in 9.2, so there is no compatibility issue
from changing them. The others require a release note comment that they
are now double precision (and can show a fractional part) rather than
bigint as before; also their underlying statistics functions now match
the column definitions, instead of returning bigint microseconds.
Diffstat (limited to 'src/include')
| -rw-r--r-- | src/include/catalog/catversion.h | 2 | ||||
| -rw-r--r-- | src/include/catalog/pg_proc.h | 32 | ||||
| -rw-r--r-- | src/include/pgstat.h | 21 |
3 files changed, 27 insertions, 28 deletions
diff --git a/src/include/catalog/catversion.h b/src/include/catalog/catversion.h index 094349f3e4..b308e4b581 100644 --- a/src/include/catalog/catversion.h +++ b/src/include/catalog/catversion.h @@ -53,6 +53,6 @@ */ /* yyyymmddN */ -#define CATALOG_VERSION_NO 201204291 +#define CATALOG_VERSION_NO 201204301 #endif diff --git a/src/include/catalog/pg_proc.h b/src/include/catalog/pg_proc.h index 5b02f17697..34b77f0191 100644 --- a/src/include/catalog/pg_proc.h +++ b/src/include/catalog/pg_proc.h @@ -2662,10 +2662,10 @@ DATA(insert OID = 3150 ( pg_stat_get_db_temp_files PGNSP PGUID 12 1 0 0 0 f f f DESCR("statistics: number of temporary files written"); DATA(insert OID = 3151 ( pg_stat_get_db_temp_bytes PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 20 "26" _null_ _null_ _null_ _null_ pg_stat_get_db_temp_bytes _null_ _null_ _null_ )); DESCR("statistics: number of bytes in temporary files written"); -DATA(insert OID = 2844 ( pg_stat_get_db_blk_read_time PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 20 "26" _null_ _null_ _null_ _null_ pg_stat_get_db_blk_read_time _null_ _null_ _null_ )); -DESCR("statistics: block read time in microseconds"); -DATA(insert OID = 2845 ( pg_stat_get_db_blk_write_time PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 20 "26" _null_ _null_ _null_ _null_ pg_stat_get_db_blk_write_time _null_ _null_ _null_ )); -DESCR("statistics: block write time in microseconds"); +DATA(insert OID = 2844 ( pg_stat_get_db_blk_read_time PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 701 "26" _null_ _null_ _null_ _null_ pg_stat_get_db_blk_read_time _null_ _null_ _null_ )); +DESCR("statistics: block read time, in msec"); +DATA(insert OID = 2845 ( pg_stat_get_db_blk_write_time PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 701 "26" _null_ _null_ _null_ _null_ pg_stat_get_db_blk_write_time _null_ _null_ _null_ )); +DESCR("statistics: block write time, in msec"); DATA(insert OID = 2769 ( pg_stat_get_bgwriter_timed_checkpoints PGNSP PGUID 12 1 0 0 0 f 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 0 f f f f t f s 0 0 20 "" _null_ _null_ _null_ _null_ pg_stat_get_bgwriter_requested_checkpoints _null_ _null_ _null_ )); @@ -2678,10 +2678,10 @@ DATA(insert OID = 2773 ( pg_stat_get_bgwriter_maxwritten_clean PGNSP PGUID 12 1 DESCR("statistics: number of times the bgwriter stopped processing when it had written too many buffers while cleaning"); DATA(insert OID = 3075 ( pg_stat_get_bgwriter_stat_reset_time PGNSP PGUID 12 1 0 0 0 f f f f t f s 0 0 1184 "" _null_ _null_ _null_ _null_ pg_stat_get_bgwriter_stat_reset_time _null_ _null_ _null_ )); DESCR("statistics: last reset for the bgwriter"); -DATA(insert OID = 3160 ( pg_stat_get_checkpoint_write_time PGNSP PGUID 12 1 0 0 0 f f f f t f s 0 0 20 "" _null_ _null_ _null_ _null_ pg_stat_get_checkpoint_write_time _null_ _null_ _null_ )); -DESCR("statistics: total amount of checkpoint time spent writing buffers to disk"); -DATA(insert OID = 3161 ( pg_stat_get_checkpoint_sync_time PGNSP PGUID 12 1 0 0 0 f f f f t f s 0 0 20 "" _null_ _null_ _null_ _null_ pg_stat_get_checkpoint_sync_time _null_ _null_ _null_ )); -DESCR("statistics: total amount of checkpoint time spent synchronizing buffers to disk"); +DATA(insert OID = 3160 ( pg_stat_get_checkpoint_write_time PGNSP PGUID 12 1 0 0 0 f f f f t f s 0 0 701 "" _null_ _null_ _null_ _null_ pg_stat_get_checkpoint_write_time _null_ _null_ _null_ )); +DESCR("statistics: checkpoint time spent writing buffers to disk, in msec"); +DATA(insert OID = 3161 ( pg_stat_get_checkpoint_sync_time PGNSP PGUID 12 1 0 0 0 f f f f t f s 0 0 701 "" _null_ _null_ _null_ _null_ pg_stat_get_checkpoint_sync_time _null_ _null_ _null_ )); +DESCR("statistics: checkpoint time spent synchronizing buffers to disk, in msec"); DATA(insert OID = 2775 ( pg_stat_get_buf_written_backend PGNSP PGUID 12 1 0 0 0 f 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 0 f f f f t f s 0 0 20 "" _null_ _null_ _null_ _null_ pg_stat_get_buf_fsync_backend _null_ _null_ _null_ )); @@ -2691,10 +2691,10 @@ DESCR("statistics: number of buffer allocations"); DATA(insert OID = 2978 ( pg_stat_get_function_calls PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 20 "26" _null_ _null_ _null_ _null_ pg_stat_get_function_calls _null_ _null_ _null_ )); DESCR("statistics: number of function calls"); -DATA(insert OID = 2979 ( pg_stat_get_function_time PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 20 "26" _null_ _null_ _null_ _null_ pg_stat_get_function_time _null_ _null_ _null_ )); -DESCR("statistics: execution time of function"); -DATA(insert OID = 2980 ( pg_stat_get_function_self_time PGNSP PGUID 12 1 0 0 0 f 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 = 2979 ( pg_stat_get_function_total_time PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 701 "26" _null_ _null_ _null_ _null_ pg_stat_get_function_total_time _null_ _null_ _null_ )); +DESCR("statistics: total execution time of function, in msec"); +DATA(insert OID = 2980 ( pg_stat_get_function_self_time PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 701 "26" _null_ _null_ _null_ _null_ pg_stat_get_function_self_time _null_ _null_ _null_ )); +DESCR("statistics: self execution time of function, in msec"); DATA(insert OID = 3037 ( pg_stat_get_xact_numscans PGNSP PGUID 12 1 0 0 0 f 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"); @@ -2716,10 +2716,10 @@ DATA(insert OID = 3045 ( pg_stat_get_xact_blocks_hit PGNSP PGUID 12 1 0 0 0 f 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 0 f 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 0 f 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 0 f 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 = 3047 ( pg_stat_get_xact_function_total_time PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 701 "26" _null_ _null_ _null_ _null_ pg_stat_get_xact_function_total_time _null_ _null_ _null_ )); +DESCR("statistics: total execution time of function in current transaction, in msec"); +DATA(insert OID = 3048 ( pg_stat_get_xact_function_self_time PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 701 "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, in msec"); DATA(insert OID = 2230 ( pg_stat_clear_snapshot PGNSP PGUID 12 1 0 0 0 f 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"); diff --git a/src/include/pgstat.h b/src/include/pgstat.h index 8549d17f28..3583bbe301 100644 --- a/src/include/pgstat.h +++ b/src/include/pgstat.h @@ -233,7 +233,7 @@ typedef struct PgStat_MsgTabstat int m_nentries; int m_xact_commit; int m_xact_rollback; - PgStat_Counter m_block_read_time; + PgStat_Counter m_block_read_time; /* times in microseconds */ PgStat_Counter m_block_write_time; PgStat_TableEntry m_entry[PGSTAT_NUM_TABENTRIES]; } PgStat_MsgTabstat; @@ -366,7 +366,7 @@ typedef struct PgStat_MsgBgWriter PgStat_Counter m_buf_written_backend; PgStat_Counter m_buf_fsync_backend; PgStat_Counter m_buf_alloc; - PgStat_Counter m_checkpoint_write_time; + PgStat_Counter m_checkpoint_write_time; /* times in milliseconds */ PgStat_Counter m_checkpoint_sync_time; } PgStat_MsgBgWriter; @@ -407,8 +407,8 @@ typedef struct PgStat_MsgTempFile typedef struct PgStat_FunctionCounts { PgStat_Counter f_numcalls; - instr_time f_time; - instr_time f_time_self; + instr_time f_total_time; + instr_time f_self_time; } PgStat_FunctionCounts; /* ---------- @@ -429,8 +429,8 @@ typedef struct PgStat_FunctionEntry { Oid f_id; PgStat_Counter f_numcalls; - PgStat_Counter f_time; /* times in microseconds */ - PgStat_Counter f_time_self; + PgStat_Counter f_total_time; /* times in microseconds */ + PgStat_Counter f_self_time; } PgStat_FunctionEntry; /* ---------- @@ -545,7 +545,6 @@ typedef struct PgStat_StatDBEntry TimestampTz stat_reset_timestamp; - /* * tables and functions must be last in the struct, because we don't write * the pointers out to the stats file. @@ -601,8 +600,8 @@ typedef struct PgStat_StatFuncEntry PgStat_Counter f_numcalls; - PgStat_Counter f_time; /* times in microseconds */ - PgStat_Counter f_time_self; + PgStat_Counter f_total_time; /* times in microseconds */ + PgStat_Counter f_self_time; } PgStat_StatFuncEntry; @@ -705,7 +704,7 @@ typedef struct PgStat_FunctionCallUsage /* NULL means we are not tracking the current function call */ PgStat_FunctionCounts *fs; /* Total time previously charged to function, as of function start */ - instr_time save_f_time; + instr_time save_f_total_time; /* Backend-wide total time as of function start */ instr_time save_total; /* system clock as of function start */ @@ -730,7 +729,7 @@ extern char *pgstat_stat_filename; extern PgStat_MsgBgWriter BgWriterStats; /* - * Updated by pgstat_count_time_* macros. + * Updated by pgstat_count_buffer_*_time macros */ extern PgStat_Counter pgStatBlockReadTime; extern PgStat_Counter pgStatBlockWriteTime; |
