Re: is there an equivavlent to auto_increment in ingres ?
- From: Mike Lay <ctsu0009@xxxxxxxxxxxxxxx>
- Date: Tue, 19 Jul 2005 16:09:01 +0100
--CELKO-- wrote:
auto incrementing primary keys .<<
A contradiction in terms! You never learned RDBMS, did you? Back to foundations!
I'm not sure that auto incrementing keys are always a bad thing, though your argument is quite solid on theoretical grounds. Consider the following situation.
System A drops a request for SYSTEM B to do something into a table. The requests consists of a customer ID, a site ID, some action flags, and a date/time stamp.
System A doesn't care how to identify the request; it's done its job.
System B comes along and starts doing its job. It spawns information out into other tables, sends letters, does other stuff.
Now, while it is true that the combined information in the original request is unique and constitutes a valid primary key, it is not a very usable key. It may consist of several columns and it's a perishing nuisance to have to replicate all these columns into tables where their only usefulness is to act as the primary key. Developers make mistakes when they forget to add the n-th part of the join, and the QEP goes spare with the apparent multiplicity of join conditions. A short snappy reference number is also useful for customers and administrators.
In this instance, an autoincrement field can be very useful, especially since you can use it in set based operations when you are inserting a hundred or thousand such request en masse.
Personally, I prefer to add a randomly generated ID to such a record (rather than sequential) (there are several reasons for this), but then you have to do your own checks that the ID is unique.
.
- Follow-Ups:
- [Info-ingres] Re: is there an equivavlent to auto_increment in ingres ?
- From: Michael Leo
- [Info-ingres] Re: is there an equivavlent to auto_increment in ingres ?
- References:
- is there an equivavlent to auto_increment in ingres ?
- From: morgan brickley
- Re: is there an equivavlent to auto_increment in ingres ?
- From: --CELKO--
- is there an equivavlent to auto_increment in ingres ?
- Prev by Date: Re: is there an equivavlent to auto_increment in ingres ?
- Next by Date: [Info-ingres] Re: is there an equivavlent to auto_increment in ingres ?
- Previous by thread: Re: is there an equivavlent to auto_increment in ingres ?
- Next by thread: [Info-ingres] Re: is there an equivavlent to auto_increment in ingres ?
- Index(es):
Relevant Pages
|