From: | Gregory Stark <stark(at)enterprisedb(dot)com> |
---|---|
To: | "Adriaan van Os" <postgres(at)microbizz(dot)nl> |
Cc: | <pgsql-bugs(at)postgresql(dot)org>, "Michael Glaesemann" <grzm(at)seespotcode(dot)net> |
Subject: | Re: BUG #3811: Getting multiple values from a sequence generator |
Date: | 2007-12-10 11:19:14 |
Message-ID: | 873auahk5p.fsf@oxford.xeocode.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs pgsql-hackers |
"Adriaan van Os" <postgres(at)microbizz(dot)nl> writes:
> Right, I want to use it with a bulk operation, say importing a million records
> with COPY. Calling nextval one million times looks to me like an enormous waste
> of resources. Suppose, you are on an ADSL line: it will cost one million times
> the ping time of the ADSL line (say 10 milliseconds per call). Well OK, one
> could write a server function that does this, but then the one million result
> values must be transported back to the client, because they are not guaranteed
> to be contiguous. Unneeded complexity compared to a simple nextval increment
> parameter.
The usual way to use nextval() is to use it on the server as an expression in
an INSERT or DEFAULT. If you're using COPY and don't have a column default set
up then, hm, I guess you're kind of stuck. That would make a good use case for
a one-time nextval(increment) or something like that.
--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com
Ask me about EnterpriseDB's PostGIS support!
From | Date | Subject | |
---|---|---|---|
Next Message | hubert depesz lubaczewski | 2007-12-10 11:31:43 | Re: BUG #3811: Getting multiple values from a sequence generator |
Previous Message | hubert depesz lubaczewski | 2007-12-10 10:12:13 | why "alter table" to change owner of sequence? |
From | Date | Subject | |
---|---|---|---|
Next Message | hubert depesz lubaczewski | 2007-12-10 11:31:43 | Re: BUG #3811: Getting multiple values from a sequence generator |
Previous Message | Peter Eisentraut | 2007-12-10 10:50:08 | Re: whats the deal with -u ? |