Re: pgbench \for or similar loop - Mailing list pgsql-hackers

From Merlin Moncure
Subject Re: pgbench \for or similar loop
Date
Msg-id BANLkTi=qVGEPsA+s2LWpJ9o+9d1vuKXkHQ@mail.gmail.com
Whole thread Raw
In response to pgbench \for or similar loop  (Alvaro Herrera <alvherre@alvh.no-ip.org>)
Responses Re: pgbench \for or similar loop  (Alvaro Herrera <alvherre@commandprompt.com>)
List pgsql-hackers
On Mon, Apr 18, 2011 at 4:02 PM, Alvaro Herrera <alvherre@alvh.no-ip.org> wrote:
> Hi,
>
> Today (and previously) I wished that pgbench had a mechanism to help
> create simple random databases.  For example, I could create a table
> "tenk" and fill it with random stuff like
>
> \setrandom foo 1 10000
> insert into foo values (:foo)
>
> Now I have to run this 10000 times or something like that.  But I don't
> want a transaction for each of those, so I had a desire for something
> like this:
>
> begin;
> \for iterator 1 10000
>  \setrandom foo 1 :iterator
>  insert into foo values (:foo);
> \end
> commit;
>
> Would something like this be acceptable?

*) what does this do that isn't already possible with 'DO' (not being
snarky, genuinely curious)?

*) should psql get some of these features?  simple logic and looping
would be a nice addition?

merlin


pgsql-hackers by date:

Previous
From: Josh Berkus
Date:
Subject: Still need mentor for advanced indexing project -- GSOC
Next
From: David Fetter
Date:
Subject: HTML tags :/