On 20 June 2012 15:32, Heikki Linnakangas <heikki.linnakan...@enterprisedb.com> wrote: > On 01.06.2012 03:02, Jeff Janes wrote: >> >> I've attached a new patch which addresses several of your concerns, >> and adds the documentation. The description is much longer than the >> descriptions of other nearby options, which mostly just give a simple >> statement of what they do rather than a description of why that is >> useful. I don't know if that means I'm starting a good trend, or a >> bad one, or I'm just putting the exposition in the wrong place. >> >> In addition to showing the benefits of coding things on the server >> side when that is applicable, it also allows hackers to stress parts >> of the server code that are not easy to stress otherwise. > > > As you mentioned in your original email over a year ago, most of this could > be done as a custom script. It's nice to have another workload to test, but > then again, there's an infinite number of workloads that might be > interesting. > > You can achieve the same with this custom script: > > \set loops 512 > > do $$ DECLARE sum integer default 0; amount integer; account_id integer; > BEGIN FOR i IN 1..:loops LOOP account_id=1 + floor(random() * :scale); > SELECT abalance into strict amount FROM pgbench_accounts WHERE aid = > account_id; sum := sum + amount; END LOOP; END; $$; > > It's a bit awkward because it has to be all on one line, and you don't get > the auto-detection of scale. But those are really the only differences > AFAICS. > > I think we would be better off improving pgbench to support those things in > custom scripts. It would be nice to be able to write initialization steps > that only run once in the beginning of the test. You could then put the > "SELECT COUNT(*) FROM pgbench_branches" there, to do the scale > auto-detection.
I'm sure Jeff submitted this because of the need for a standard test, rather than the wish to actually modify pgbench itself. Can I suggest that we include a list of standard scripts with pgbench for this purpose? These can then be copied alongside the binary when we do an install. That way this patch can become a standard script, plus an entry in the docs to list this. We could even include scripts for the usual cases, to allow them to be more easily viewed/copied/modified. -- Simon Riggs http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers