1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-11 20:28:21 +03:00

Adjust timing units in pg_stat_statements.

Display total time and I/O timings in milliseconds, for consistency with
the units used for timings in the core statistics views.  The columns
remain of float8 type, so that sub-msec precision is available.  (At some
point we will probably want to convert the core views to use float8 type
for the same reason, but this patch does not touch that issue.)

This is a release-note-requiring change in the meaning of the total_time
column.  The I/O timing columns are new as of 9.2, so there is no
compatibility impact from redefining them.

Do some minor copy-editing in the documentation, too.
This commit is contained in:
Tom Lane
2012-04-28 16:03:57 -04:00
parent cdbad241f4
commit 93f94e356d
2 changed files with 25 additions and 25 deletions

View File

@ -101,7 +101,7 @@ typedef struct pgssHashKey
typedef struct Counters
{
int64 calls; /* # of times executed */
double total_time; /* total execution time in seconds */
double total_time; /* total execution time, in msec */
int64 rows; /* total # of retrieved or affected rows */
int64 shared_blks_hit; /* # of shared buffer hits */
int64 shared_blks_read; /* # of shared disk blocks read */
@ -113,8 +113,8 @@ typedef struct Counters
int64 local_blks_written; /* # of local disk blocks written */
int64 temp_blks_read; /* # of temp blocks read */
int64 temp_blks_written; /* # of temp blocks written */
double time_read; /* time spent reading in seconds */
double time_write; /* time spent writing in seconds */
double time_read; /* time spent reading, in msec */
double time_write; /* time spent writing, in msec */
double usage; /* usage factor */
} Counters;
@ -752,7 +752,7 @@ pgss_ExecutorEnd(QueryDesc *queryDesc)
pgss_store(queryDesc->sourceText,
queryId,
queryDesc->totaltime->total,
queryDesc->totaltime->total * 1000.0, /* convert to msec */
queryDesc->estate->es_processed,
&queryDesc->totaltime->bufusage,
NULL);
@ -856,7 +856,7 @@ pgss_ProcessUtility(Node *parsetree, const char *queryString,
pgss_store(queryString,
queryId,
INSTR_TIME_GET_DOUBLE(duration),
INSTR_TIME_GET_MILLISEC(duration),
rows,
&bufusage,
NULL);
@ -1021,9 +1021,9 @@ pgss_store(const char *query, uint32 queryId,
e->counters.local_blks_written += bufusage->local_blks_written;
e->counters.temp_blks_read += bufusage->temp_blks_read;
e->counters.temp_blks_written += bufusage->temp_blks_written;
e->counters.time_read += INSTR_TIME_GET_DOUBLE(bufusage->time_read);
e->counters.time_write += INSTR_TIME_GET_DOUBLE(bufusage->time_write);
e->counters.usage += USAGE_EXEC(duration);
e->counters.time_read += INSTR_TIME_GET_MILLISEC(bufusage->time_read);
e->counters.time_write += INSTR_TIME_GET_MILLISEC(bufusage->time_write);
e->counters.usage += USAGE_EXEC(total_time);
SpinLockRelease(&e->mutex);
}