[phplib] nextid and performance From: Bryan Brunton (Bryan.Brunton <email protected>)
Date: 10/03/00

I sent a message a couple days back about postgresql
and getlastoid. I noticed that the latest db_psql has a
nextid function.

Ids fields in my PostgreSQL DB are auto-updating through
the use of setting field default to nextval('seq_id') like
the PostgreSQL manual suggests.

I guess the point of nextid is portability.

I have a question however about performance. Using
nextid and non-auto-updating id fields requires
2 queries before every insert to retrieve the nextid
value.

What do you do in cases where a large number of
inserts are necessary? All of those additional queries
would severely hurt performance. And wrapping the inserts
in a transaction might not be possible in certain
situations.

Retrieving an array of nextids and then looping through
them would result in ugly, messy code.

Is this a well known issue/preference debate in database
design that I am just not aware of?

---------------------------------------------------------------------
To unsubscribe, e-mail: phplib-unsubscribe <email protected>
For additional commands, e-mail: phplib-help <email protected>