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 */
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;
pgss_store(queryDesc->sourceText,
queryId,
- queryDesc->totaltime->total,
+ queryDesc->totaltime->total * 1000.0, /* convert to msec */
queryDesc->estate->es_processed,
&queryDesc->totaltime->bufusage,
NULL);
pgss_store(queryString,
queryId,
- INSTR_TIME_GET_DOUBLE(duration),
+ INSTR_TIME_GET_MILLISEC(duration),
rows,
&bufusage,
NULL);
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);
}
<entry><structfield>total_time</structfield></entry>
<entry><type>double precision</type></entry>
<entry></entry>
- <entry>Total time spent in the statement, in seconds</entry>
+ <entry>Total time spent in the statement, in milliseconds</entry>
</row>
<row>
<entry><structfield>shared_blks_hit</structfield></entry>
<entry><type>bigint</type></entry>
<entry></entry>
- <entry>Total number of shared blocks hits by the statement</entry>
+ <entry>Total number of shared block cache hits by the statement</entry>
</row>
<row>
<entry><structfield>shared_blks_read</structfield></entry>
<entry><type>bigint</type></entry>
<entry></entry>
- <entry>Total number of shared blocks reads by the statement</entry>
+ <entry>Total number of shared blocks read by the statement</entry>
</row>
<row>
<entry><structfield>shared_blks_written</structfield></entry>
<entry><type>bigint</type></entry>
<entry></entry>
- <entry>Total number of shared blocks writes by the statement</entry>
+ <entry>Total number of shared blocks written by the statement</entry>
</row>
<row>
<entry><structfield>local_blks_hit</structfield></entry>
<entry><type>bigint</type></entry>
<entry></entry>
- <entry>Total number of local blocks hits by the statement</entry>
+ <entry>Total number of local block cache hits by the statement</entry>
</row>
<row>
<entry><structfield>local_blks_read</structfield></entry>
<entry><type>bigint</type></entry>
<entry></entry>
- <entry>Total number of local blocks reads by the statement</entry>
+ <entry>Total number of local blocks read by the statement</entry>
</row>
<row>
<entry><structfield>local_blks_written</structfield></entry>
<entry><type>bigint</type></entry>
<entry></entry>
- <entry>Total number of local blocks writes by the statement</entry>
+ <entry>Total number of local blocks written by the statement</entry>
</row>
<row>
<entry><structfield>temp_blks_read</structfield></entry>
<entry><type>bigint</type></entry>
<entry></entry>
- <entry>Total number of temp blocks reads by the statement</entry>
+ <entry>Total number of temp blocks read by the statement</entry>
</row>
<row>
<entry><structfield>temp_blks_written</structfield></entry>
<entry><type>bigint</type></entry>
<entry></entry>
- <entry>Total number of temp blocks writes by the statement</entry>
+ <entry>Total number of temp blocks written by the statement</entry>
</row>
<row>
<entry><type>double precision</type></entry>
<entry></entry>
<entry>
- Total time the statement spent reading blocks, in seconds
+ Total time the statement spent reading blocks, in milliseconds
(if <xref linkend="guc-track-iotiming"> is enabled, otherwise zero)
</entry>
</row>
<entry><type>double precision</type></entry>
<entry></entry>
<entry>
- Total time the statement spent writing blocks, in seconds
+ Total time the statement spent writing blocks, in milliseconds
(if <xref linkend="guc-track-iotiming"> is enabled, otherwise zero)
</entry>
</row>
Specify <literal>top</> to track top-level statements (those issued
directly by clients), <literal>all</> to also track nested statements
(such as statements invoked within functions), or <literal>none</> to
- disable.
+ disable statement statistics collection.
The default value is <literal>top</>.
Only superusers can change this setting.
</para>
-[ RECORD 1 ]---------------------------------------------------------------------
query | UPDATE pgbench_branches SET bbalance = bbalance + ? WHERE bid = ?;
calls | 3000
-total_time | 9.60900100000002
+total_time | 9609.00100000002
rows | 2836
hit_percent | 99.9778970000200936
-[ RECORD 2 ]---------------------------------------------------------------------
query | UPDATE pgbench_tellers SET tbalance = tbalance + ? WHERE tid = ?;
calls | 3000
-total_time | 8.015156
+total_time | 8015.156
rows | 2990
hit_percent | 99.9731126579631345
-[ RECORD 3 ]---------------------------------------------------------------------
query | copy pgbench_accounts from stdin
calls | 1
-total_time | 0.310624
+total_time | 310.624
rows | 100000
hit_percent | 0.30395136778115501520
-[ RECORD 4 ]---------------------------------------------------------------------
query | UPDATE pgbench_accounts SET abalance = abalance + ? WHERE aid = ?;
calls | 3000
-total_time | 0.271741999999997
+total_time | 271.741999999997
rows | 3000
hit_percent | 93.7968855088209426
-[ RECORD 5 ]---------------------------------------------------------------------
query | alter table pgbench_accounts add primary key (aid)
calls | 1
-total_time | 0.08142
+total_time | 81.42
rows | 0
hit_percent | 34.4947735191637631
</screen>