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.
-- Heikki Linnakangas EnterpriseDB http://www.enterprisedb.com