Re: pgbench \for or similar loop

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Merlin Moncure <mmoncure(at)gmail(dot)com>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pgbench \for or similar loop
Date: 2011-04-18 21:37:43
Message-ID: 1303162423-sup-5894@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Excerpts from Merlin Moncure's message of lun abr 18 18:26:54 -0300 2011:
> On Mon, Apr 18, 2011 at 4:02 PM, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> wrote:

> > 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)?

Uhm, not sure. I'm not really used to having DO available so I didn't
think about it. I'll look at it a bit more.

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

I dunno. They have been proposed and shot down in the past. Apparently
people don't want psql to become too powerful. ("But that would make
psql turing complete! Soon you're going to want to have \while on it!").
I think pgbench is supposed to be designed to handle data in bulk which
is why I started using it for this in the first place.

--
Álvaro Herrera <alvherre(at)commandprompt(dot)com>
The PostgreSQL Company - Command Prompt, Inc.
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2011-04-18 21:44:03 Re: HTML tags :/
Previous Message David Fetter 2011-04-18 21:34:11 HTML tags :/