Re: pgbench -f and vacuum - Mailing list pgsql-hackers

From Tatsuo Ishii
Subject Re: pgbench -f and vacuum
Date
Msg-id 20150209.145449.2175464237557137771.t-ishii@sraoss.co.jp
Whole thread Raw
In response to Re: pgbench -f and vacuum  (Michael Paquier <michael.paquier@gmail.com>)
Responses Re: pgbench -f and vacuum
List pgsql-hackers
>>> Although that might be taking this thread rather far off-topic.
>> Not really sure about that, because the only outstanding objection to
>> this discussion is what happens in the startup stage if you specify -f.
>> Right now vacuum is attempted on the standard tables, which is probably
>> not the right thing in the vast majority of cases.  But if we turn that
>> off, how do we reinstate it for the rare cases that want it?  Personally
>> I would just leave it turned off and be done with it, but if we want to
>> provide some way to re-enable it, this --startup-script=FILE gadget
>> sounds like a pretty decent idea.
> (Catching up with this thread)
> Yes I think that it would be more simple to simply turn off the
> internal VACUUM if -f is specified. For the cases where we still need
> to vacuum the tables pgbench_*, we could simply document to run a
> VACUUM on them.

Agreed. Here is the patch to implement the idea: -f just implies -n.

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 ddd11a0..f3d7e90 100644
--- a/contrib/pgbench/pgbench.c
+++ b/contrib/pgbench/pgbench.c
@@ -2872,6 +2872,7 @@ main(int argc, char **argv)            case 'f':                benchmarking_option_set = true;
            ttype = 3;
 
+                is_no_vacuum = true;    /* "-f" implies "-n" (no vacuum) */                filename =
pg_strdup(optarg);               if (process_file(filename) == false || *sql_files[num_files - 1] == NULL)
     exit(1);
 
diff --git a/doc/src/sgml/pgbench.sgml b/doc/src/sgml/pgbench.sgml
index 7d203cd..b545ea3 100644
--- a/doc/src/sgml/pgbench.sgml
+++ b/doc/src/sgml/pgbench.sgml
@@ -316,6 +316,10 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
<option>-N</option>,<option>-S</option>, and <option>-f</option>        are mutually exclusive.       </para>
 
+       <para>
+        Please note that <option>-f</option> implies <option>-n</option>, which means that VACUUM for the standard
pgbenchtables will not be performed before the bench marking.
 
+You should run the VACUUM command beforehand if necessary.
+       </para>      </listitem>     </varlistentry>

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: RangeType internal use
Next
From: Fujii Masao
Date:
Subject: Re: [REVIEW] Re: Compression of full-page-writes