Re: pgbench with large scale factor - Mailing list pgsql-hackers

From Tatsuo Ishii
Subject Re: pgbench with large scale factor
Date
Msg-id 20131212.162831.577821376157686362.t-ishii@sraoss.co.jp
Whole thread Raw
In response to Re: pgbench with large scale factor  (Fabien COELHO <coelho@cri.ensmp.fr>)
Responses Re: pgbench with large scale factor
List pgsql-hackers
Fabien,

>> Included is a proposed fix for this (also fixing weired "remaining"
>> part). If there's no objection, I will commit it.
> 
> Looks ok, but I would consider switching to "double" instead of
> "int64".

Assuming you are talking about "remaining sec" part, I agree. Here is
the revised patch.

Best regards,
--
Tatsuo Ishii
SRA OSS, Inc. Japan
English: http://www.sraoss.co.jp/index_en.php
Japanese: http://www.sraoss.co.jp
diff --git a/contrib/pgbench/pgbench.c b/contrib/pgbench/pgbench.c
index 2c96fae..00374d8 100644
--- a/contrib/pgbench/pgbench.c
+++ b/contrib/pgbench/pgbench.c
@@ -1720,11 +1720,11 @@ init(bool is_no_vacuum)            INSTR_TIME_SUBTRACT(diff, start);            elapsed_sec =
INSTR_TIME_GET_DOUBLE(diff);
-            remaining_sec = (scale * naccounts - j) * elapsed_sec / j;
+            remaining_sec = ((double)scale * naccounts - j) * elapsed_sec / j;            fprintf(stderr, INT64_FORMAT
"of " INT64_FORMAT " tuples (%d%%) done (elapsed %.2f s, remaining %.2f s).\n",                    j, (int64) naccounts
*scale,
 
-                    (int) (((int64) j * 100) / (naccounts * scale)),
+                    (int) (((int64) j * 100) / (naccounts * (int64)scale)),                    elapsed_sec,
remaining_sec);       }        /* let's not call the timing for each row, but only each 100 rows */ 

pgsql-hackers by date:

Previous
From: Dev Kumkar
Date:
Subject: Re: [GENERAL] Case sensitivity
Next
From: Pavel Stehule
Date:
Subject: Re: plpgsql_check_function - rebase for 9.3