Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1aO6DS-0001r2-7T for pgsql-hackers@arkaria.postgresql.org; Tue, 26 Jan 2016 16:11:38 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1aO6DR-0000fA-QZ for pgsql-hackers@arkaria.postgresql.org; Tue, 26 Jan 2016 16:11:37 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1aO6DQ-0000c3-0v for pgsql-hackers@postgresql.org; Tue, 26 Jan 2016 16:11:36 +0000 Received: from out.smtp-auth.no-ip.com ([8.23.224.60]) by magus.postgresql.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84) (envelope-from ) id 1aO6DG-0001SB-H2 for pgsql-hackers@postgresql.org; Tue, 26 Jan 2016 16:11:35 +0000 X-No-IP: alvh.no-ip.org@noip-smtp X-Report-Spam-To: abuse@no-ip.com Received: from alvin.alvh.no-ip.org (unknown [85.119.43.8]) (Authenticated sender: alvh.no-ip.org@noip-smtp) by smtp-auth.no-ip.com (Postfix) with ESMTPA id E75ED4011BF; Tue, 26 Jan 2016 08:11:17 -0800 (PST) Received: by alvin.alvh.no-ip.org (Postfix, from userid 1000) id CDF947E1; Mon, 25 Jan 2016 22:22:31 -0300 (CLT) Date: Mon, 25 Jan 2016 22:22:31 -0300 From: Alvaro Herrera To: Fabien COELHO Cc: "pgsql-hackers@postgresql.org" Subject: Re: pgbench stats per script & other stuff Message-ID: <20160126012231.GA549232@alvherre.pgsql> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="BOKacYhQ+x31HxR3" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) X-Pg-Spam-Score: -0.1 (/) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org --BOKacYhQ+x31HxR3 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit Fabien COELHO wrote: > a) add -b option for cumulating builtins and rework internal script > management so that builtin and external scripts are managed the > same way. I tweaked this a bit. I found a bug in threadRun: it was reading the commands first, and setting st->use_file later. This led to the wrong commands being read. Some other less interesting changes: * made chooseScript have the logic to react to single existing script; no need to inject ternary operators in each caller to check for that condition. * Added a debug line every time a script is chosen, + if (debug) + fprintf(stderr, "client %d executing script \"%s\"\n", st->id, + sql_script[st->use_file].name); (I'd have liked to have chooseScript itself do it, but it doesn't have the script name handy. Maybe this indicates that the data structures are slightly wrong.) * Added a separate routine to list available scripts; originally that was duplicated in "-b list" and when -b got an invalid script name. * In usage(), I split out the options to select a script instead of mixing them within "Benchmarking options"; also changed wording of parenthical comment, no longer carrying the full list of scripts (a choice which also omitted "-b list" itself): + "\nOptions to select what to run:\n" + " -b, --builtin=NAME add buitin script (use \"-b list\" to display\n" + " available scripts)\n" + " -f, --file=FILENAME add transaction script from FILENAME\n" + " -N, --skip-some-updates skip updates of pgbench_tellers and pgbench_branches\n" + " (same as \"-b simple-update\")\n" + " -S, --select-only perform SELECT-only transactions\n" + " (same as \"-b select-only\")\n" I couldn't find a better heading to use there, so that'll have to do unless someone has a better idea. Some other trivial changes. Patch attached. I plan to push this as soon as I'm able. -- Álvaro Herrera http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services --BOKacYhQ+x31HxR3 Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="pgbench-script-stats-14-a.patch" diff --git a/doc/src/sgml/ref/pgbench.sgml b/doc/src/sgml/ref/pgbench.sgml index 541d17b..fdd3331 100644 --- a/doc/src/sgml/ref/pgbench.sgml +++ b/doc/src/sgml/ref/pgbench.sgml @@ -261,6 +261,23 @@ pgbench options dbname benchmarking arguments: + + + + + + Add the specified builtin script to the list of executed scripts. + Available builtin scripts are: tpcb-like, + simple-update and select-only. + The provided scriptname needs only to be a prefix + of the builtin name, hence simp would be enough to select + simple-update. + With special name list, show the list of builtin scripts + and exit immediately. + + + + clients @@ -307,14 +324,13 @@ pgbench options dbname - filename - filename + + - Read transaction script from filename. + Add a transaction script read from filename to + the list of executed scripts. See below for details. - , , and - are mutually exclusive. @@ -404,10 +420,8 @@ pgbench options dbname - Do not update pgbench_tellers and - pgbench_branches. - This will avoid update contention on these tables, but - it makes the test case even less like TPC-B. + Run builtin simple-update script. + Shorthand for @@ -512,9 +526,9 @@ pgbench options dbname Report the specified scale factor in pgbench's output. With the built-in tests, this is not necessary; the correct scale factor will be detected by counting the number of - rows in the pgbench_branches table. However, when testing - custom benchmarks (