Archives of the TeradataForum
Message Posted: Fri, 26 Sep 2003 @ 15:21:10 GMT
Subj: | | Re: Changing PK values |
|
From: | | Chuck McDevitt |
Again, lots of confusion between PRIMARY KEY and PRIMARY INDEX.
In Teradata, the primary index is not necessarily the primary key. It would better be named the "distribution index". It determines
what VAMP the row belongs to, and where on disk the row ends up.
Changing a primary index value is expensive, since internally it must delete the row from one VAMP, and re-insert it on another.
Expensive, slow, but not a violation of relational theory. You are just changing the values of some attributes in the row.
The Primary Key, on the other hand, is the set of attributes that logically and uniquely define what row we are talking about. It can't
be null, and changing it would be a major problem because of foreign keys that might point to this primary key.
By default, if you specify a primary key in your table, those columns also become the UNIQUE PRIMARY INDEX, unless you explicitly specify
some other attributes should be the primary index.
|