Hi,
I have a database that has types in them with unique names. These types
are referenced from other tables through a surrogate integer key. I'm
now wondering if I should eliminate that surrogate key and just use the
name as the primary key. Afaiu, surrogate keys are primarily there to
make joining tables or otherwise searching for a record faster, because
it's faster to compare two integers than it is to compare two strings.
Now when I want to search for a type in types or another table that
references types(type_id), under what circumstances is it advisable to
have a surrogate integer key and not use the unique type name? Is
searching for an integer as fast as is searching for a string when both
have an index? How many records in the type table do I need to make a
surrogate key a not unsignificantly faster way to retrieve a row? What
about joins? Are these the right questions?
Thanks.
--
Markus Bertheau <twanger@bluetwanger.de>