From fe1b5034dd557822b28877bf423828d37c847702 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Fri, 17 Oct 2003 01:14:26 +0000 Subject: [PATCH] Adjust display of actual runtimes in EXPLAIN output to use three fractional digits, and label it 'ms' not 'msec', for consistency with psql's \timing display. Per recent discussions. --- doc/src/sgml/perform.sgml | 10 +++++----- doc/src/sgml/ref/explain.sgml | 8 ++++---- src/backend/commands/explain.c | 6 +++--- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/doc/src/sgml/perform.sgml b/doc/src/sgml/perform.sgml index 2eaab4d0f0..cdc96ac56b 100644 --- a/doc/src/sgml/perform.sgml +++ b/doc/src/sgml/perform.sgml @@ -1,5 +1,5 @@ @@ -284,16 +284,16 @@ EXPLAIN ANALYZE SELECT * FROM tenk1 t1, tenk2 t2 WHERE t1.unique1 < 50 AND t1 QUERY PLAN ------------------------------------------------------------------------------- Nested Loop (cost=0.00..327.02 rows=49 width=296) - (actual time=1.18..29.82 rows=50 loops=1) + (actual time=1.181..29.822 rows=50 loops=1) -> Index Scan using tenk1_unique1 on tenk1 t1 (cost=0.00..179.33 rows=49 width=148) - (actual time=0.63..8.91 rows=50 loops=1) + (actual time=0.630..8.917 rows=50 loops=1) Index Cond: (unique1 < 50) -> Index Scan using tenk2_unique2 on tenk2 t2 (cost=0.00..3.01 rows=1 width=148) - (actual time=0.29..0.32 rows=1 loops=50) + (actual time=0.295..0.324 rows=1 loops=50) Index Cond: ("outer".unique2 = t2.unique2) - Total runtime: 31.60 msec + Total runtime: 31.604 ms Note that the actual time values are in milliseconds of diff --git a/doc/src/sgml/ref/explain.sgml b/doc/src/sgml/ref/explain.sgml index 754863881d..942dcf7bad 100644 --- a/doc/src/sgml/ref/explain.sgml +++ b/doc/src/sgml/ref/explain.sgml @@ -1,5 +1,5 @@ @@ -210,10 +210,10 @@ EXPLAIN ANALYZE EXECUTE query(100, 200); QUERY PLAN ------------------------------------------------------------------------------------------------------------------------- - HashAggregate (cost=39.53..39.53 rows=1 width=8) (actual time=0.66..0.67 rows=7 loops=1) - -> Index Scan using test_pkey on test (cost=0.00..32.97 rows=1311 width=8) (actual time=0.05..0.39 rows=99 loops=1) + HashAggregate (cost=39.53..39.53 rows=1 width=8) (actual time=0.661..0.672 rows=7 loops=1) + -> Index Scan using test_pkey on test (cost=0.00..32.97 rows=1311 width=8) (actual time=0.050..0.395 rows=99 loops=1) Index Cond: ((id > $1) AND (id < $2)) - Total runtime: 0.85 msec + Total runtime: 0.851 ms (4 rows) diff --git a/src/backend/commands/explain.c b/src/backend/commands/explain.c index eb73c91409..1b34b17585 100644 --- a/src/backend/commands/explain.c +++ b/src/backend/commands/explain.c @@ -7,7 +7,7 @@ * Portions Copyright (c) 1994-5, Regents of the University of California * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/commands/explain.c,v 1.116 2003/09/25 18:58:35 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/commands/explain.c,v 1.117 2003/10/17 01:14:26 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -270,7 +270,7 @@ ExplainOnePlan(QueryDesc *queryDesc, ExplainStmt *stmt, if (es->printCost) { if (stmt->analyze) - appendStringInfo(str, "Total runtime: %.2f msec\n", + appendStringInfo(str, "Total runtime: %.3f ms\n", 1000.0 * totaltime); do_text_output_multiline(tstate, str->data); } @@ -582,7 +582,7 @@ explain_outNode(StringInfo str, { double nloops = planstate->instrument->nloops; - appendStringInfo(str, " (actual time=%.2f..%.2f rows=%.0f loops=%.0f)", + appendStringInfo(str, " (actual time=%.3f..%.3f rows=%.0f loops=%.0f)", 1000.0 * planstate->instrument->startup / nloops, 1000.0 * planstate->instrument->total / nloops, planstate->instrument->ntuples / nloops,