"Adriaan van Os" <[EMAIL PROTECTED]> 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!

---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
       choose an index scan if your joining column's datatypes do not
       match

Reply via email to