If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Numberic Field for Lookup
I designed a huge database 10 years ago. I finally am going back and cleaning
things up. There are several tables that I used a text field as a primary field. I would like to delete the relationships, create an autonumber field for each table, and recreate the relationships. I have 147 queries though so it would be a lot of work. Everything works, so would the database run better using a numberic field? Thanks! |
#2
|
|||
|
|||
Numberic Field for Lookup
For tables where there is a simple, obvious, short, natural primary key, use
it. For example, if you have a table of categories where each category name is unique, required, and say 24 characters or less, it makes good sense to use the category name as the primary key IMHO. IME, there is no practical difference in performance when using a text-key for these little tables with 1000 records. Some developers avoid this because they have generic routines that assume a particular data type. You do have to remember to add the quote delimters when matching a value in a text field. Sometimes the text primary key is really handy, e.g. it avoids some problems Access has when a combo's bound column is not the display problem: http://allenbrowne.com/bug-06.html So, I'm not convinced it would be worth the effort to change them all. If you do have problems in remembering the data types and sizes for all the fields in your projects, here's what I use: Relationship Report with extended field information at: http://allenbrowne.com/AppRelReport.html -- Allen Browne - Microsoft MVP. Perth, Western Australia Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than allenbrowne at mvps dot org. "Rita" wrote in message ... I designed a huge database 10 years ago. I finally am going back and cleaning things up. There are several tables that I used a text field as a primary field. I would like to delete the relationships, create an autonumber field for each table, and recreate the relationships. I have 147 queries though so it would be a lot of work. Everything works, so would the database run better using a numberic field? Thanks! |
#3
|
|||
|
|||
Numberic Field for Lookup
Well that's good to hear! I thought the database ran more efficient if the
foreign keys were numeric. Thanks so much for the Relationship Report with extended field information!!!! What a wonderful tool! "Allen Browne" wrote: For tables where there is a simple, obvious, short, natural primary key, use it. For example, if you have a table of categories where each category name is unique, required, and say 24 characters or less, it makes good sense to use the category name as the primary key IMHO. IME, there is no practical difference in performance when using a text-key for these little tables with 1000 records. Some developers avoid this because they have generic routines that assume a particular data type. You do have to remember to add the quote delimters when matching a value in a text field. Sometimes the text primary key is really handy, e.g. it avoids some problems Access has when a combo's bound column is not the display problem: http://allenbrowne.com/bug-06.html So, I'm not convinced it would be worth the effort to change them all. If you do have problems in remembering the data types and sizes for all the fields in your projects, here's what I use: Relationship Report with extended field information at: http://allenbrowne.com/AppRelReport.html -- Allen Browne - Microsoft MVP. Perth, Western Australia Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than allenbrowne at mvps dot org. "Rita" wrote in message ... I designed a huge database 10 years ago. I finally am going back and cleaning things up. There are several tables that I used a text field as a primary field. I would like to delete the relationships, create an autonumber field for each table, and recreate the relationships. I have 147 queries though so it would be a lot of work. Everything works, so would the database run better using a numberic field? Thanks! |
#4
|
|||
|
|||
Numberic Field for Lookup
Well, in theory, it is true that joins based on numeric fields are more
efficient. However, if the difference is milliseconds, the practical difference to the user is negligible. My experience is that small databases sometimes become large, and so I develop for the future. But if your users aren't bothered by the difference, it's probably not worth it to backfill, IMO. On the other hand, if performance is an issue, that might be one way to improve it. -- --Roger Carlson MS Access MVP Access Database Samples: www.rogersaccesslibrary.com Want answers to your Access questions in your Email? Free subscription: http://peach.ease.lsoft.com/scripts/...UBED1=ACCESS-L "Rita" wrote in message ... Well that's good to hear! I thought the database ran more efficient if the foreign keys were numeric. Thanks so much for the Relationship Report with extended field information!!!! What a wonderful tool! "Allen Browne" wrote: For tables where there is a simple, obvious, short, natural primary key, use it. For example, if you have a table of categories where each category name is unique, required, and say 24 characters or less, it makes good sense to use the category name as the primary key IMHO. IME, there is no practical difference in performance when using a text-key for these little tables with 1000 records. Some developers avoid this because they have generic routines that assume a particular data type. You do have to remember to add the quote delimters when matching a value in a text field. Sometimes the text primary key is really handy, e.g. it avoids some problems Access has when a combo's bound column is not the display problem: http://allenbrowne.com/bug-06.html So, I'm not convinced it would be worth the effort to change them all. If you do have problems in remembering the data types and sizes for all the fields in your projects, here's what I use: Relationship Report with extended field information at: http://allenbrowne.com/AppRelReport.html -- Allen Browne - Microsoft MVP. Perth, Western Australia Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than allenbrowne at mvps dot org. "Rita" wrote in message ... I designed a huge database 10 years ago. I finally am going back and cleaning things up. There are several tables that I used a text field as a primary field. I would like to delete the relationships, create an autonumber field for each table, and recreate the relationships. I have 147 queries though so it would be a lot of work. Everything works, so would the database run better using a numberic field? Thanks! |
Thread Tools | |
Display Modes | |
|
|