Re: [GENERAL] using ID as a key
От | Sevo Stille |
---|---|
Тема | Re: [GENERAL] using ID as a key |
Дата | |
Msg-id | 389EBA3F.D5F54037@ip23.net обсуждение исходный текст |
Ответ на | Re: [GENERAL] using ID as a key (davidb@vectormath.com) |
Ответы |
Re: [GENERAL] using ID as a key
|
Список | pgsql-general |
davidb@vectormath.com wrote: > > Hi Sheila, > > For general database design considerations (not specific to Postgres) I > disagree with the others on the use of serials and sequences. These > things never migrate well from platform to platform, they often break, and > dealing with them is a nightmare if you ever have to do any bulk data > copying. > ID generation ought to be handled programmatically. At the server? This is what OIDs do - alas, these are even less portable than serials and sequences. At the client interface? Nice, as long as you have a single user database. In a multiuser environment, generating and maintaining a unique ID externally to the database is close to impossible. Simply incrementing the highest available ID from the database by one is error prone, even if you catch duplicate insertions by making the ID field UNIQUE and incrementing the ID in a loop until you succeed - a slow client in a heavily updated database might permanently fail to insert his record before the generated ID is used by some other, faster client. And generating unique IDs based on an database-independent would require some synchronized mechanism for ID generation, adding dependency on the ID source to dependency on the database. Sevo -- Sevo Stille sevo@ip23.net
В списке pgsql-general по дате отправления: