Re: BUG #3811: Getting multiple values from a sequence generator
От | Gregory Stark |
---|---|
Тема | Re: BUG #3811: Getting multiple values from a sequence generator |
Дата | |
Msg-id | 873auahk5p.fsf@oxford.xeocode.com обсуждение исходный текст |
Ответ на | BUG #3811: Getting multiple values from a sequence generator ("Adriaan van Os" <postgres@microbizz.nl>) |
Ответы |
Re: BUG #3811: Getting multiple values from a sequence generator
|
Список | pgsql-bugs |
"Adriaan van Os" <postgres@microbizz.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!
В списке pgsql-bugs по дате отправления: