Re: Creating blank records with sequential record numbers - Mailing list pgsql-general

From Scott Marlowe
Subject Re: Creating blank records with sequential record numbers
Date
Msg-id 1091816445.27166.220.camel@localhost.localdomain
Whole thread Raw
In response to Creating blank records with sequential record numbers  (o.blomqvist@secomintl.com (Otto Blomqvist))
List pgsql-general
On Thu, 2004-08-05 at 12:55, Otto Blomqvist wrote:
> Hello!
>
> I'm pretty sure this is an easy thing to do but I cant still figure
> out how. I have a table with about 20 columns, one column being the
> record_number. I want to insert 100'000 new records with 1, 2, 3, 4
> ... 100'000 in the record_number field. All the other columns can be
> left at nulls or whatever the default is.
>
> Right now I'm doing this using a "for" loop in my app. Not very fast
> or smart
>
> Any better ideas ?

As long as you're wrapping it all into one big transaction, you're fine
using a for next loop.  Sure, you could probably write a pl function to
do it, but I can't see it being worth the development effort if you've
already got a script doing it.




pgsql-general by date:

Previous
From: "Scott Marlowe"
Date:
Subject: Re: Slow after VACUUM, fast after DROP-CREATE INDEX
Next
From: "Scott Marlowe"
Date:
Subject: Re: Data version idea (please discuss)