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

From David Fetter
Subject Re: pgbench \for or similar loop
Date
Msg-id 20110419144146.GA25292@fetter.org
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
List pgsql-hackers
On Mon, Apr 18, 2011 at 06:02:53PM -0300, Alvaro Herrera 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?

Are existing mechanisms (WITH and DO) insufficient for the purpose?

Cheers,
David.
-- 
David Fetter <david@fetter.org> http://fetter.org/
Phone: +1 415 235 3778  AIM: dfetter666  Yahoo!: dfetter
Skype: davidfetter      XMPP: david.fetter@gmail.com
iCal: webcal://www.tripit.com/feed/ical/people/david74/tripit.ics

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate


pgsql-hackers by date:

Previous
From: Michael Meskes
Date:
Subject: Re: Windows 64 bit warnings
Next
From: Tom Lane
Date:
Subject: Re: Windows 64 bit warnings