C
Chris
If this topic is addressed in a FAQ or other online
resource, I'd be glad to have a pointer to it. I've
tried to find it addressed in several books and by
searching these newsgroups...
What factors, if any - performance? db size? other? -
are important in choosing the data type for a primary
key? Since one always has the option of using, for
example, an Autonumber as a primary key, are there
times when that choice is prefered even though there
is some other unique attribute in the data itself?
For example, a simple single-attribute table of allowed
categories (to be used as a lookup table for assigning
records from another table to different categories)
could use the category name itself as a primary key -
all category names will be unique. But does it make
sense to use this text field as a foreign key in
another table, or is it better to create an additional
autonumber field in the category table?
I think what I'm really wondering about is the
implementation of primary/foreign keys: if there is
only a single text attribute in a table, used as a
primary key, what gets stored in the other table where
it is a foreign key? Is it the text itself, which
could be quite sizable? Or does Access use internal
record numbers or the field indexes as the value for
the foreign key? I would expect performance and/or
storage size penalties if the actual primary key
value (text, in this example) is stored in the other
table as the foreign key.
I have this feeling I'm missing some fundamental
concepts here, and appreciate any help in putting
me on the path towards clearer understanding. Thanks
in advance,
Chris
resource, I'd be glad to have a pointer to it. I've
tried to find it addressed in several books and by
searching these newsgroups...
What factors, if any - performance? db size? other? -
are important in choosing the data type for a primary
key? Since one always has the option of using, for
example, an Autonumber as a primary key, are there
times when that choice is prefered even though there
is some other unique attribute in the data itself?
For example, a simple single-attribute table of allowed
categories (to be used as a lookup table for assigning
records from another table to different categories)
could use the category name itself as a primary key -
all category names will be unique. But does it make
sense to use this text field as a foreign key in
another table, or is it better to create an additional
autonumber field in the category table?
I think what I'm really wondering about is the
implementation of primary/foreign keys: if there is
only a single text attribute in a table, used as a
primary key, what gets stored in the other table where
it is a foreign key? Is it the text itself, which
could be quite sizable? Or does Access use internal
record numbers or the field indexes as the value for
the foreign key? I would expect performance and/or
storage size penalties if the actual primary key
value (text, in this example) is stored in the other
table as the foreign key.
I have this feeling I'm missing some fundamental
concepts here, and appreciate any help in putting
me on the path towards clearer understanding. Thanks
in advance,
Chris