I'm creating a database for a dictionary. Consider the table WORD. My current plan is to make its primary key word_id
which will be an integer, then give it another attribute text
which is the textual representation of the word.
However, I thought that since it's a dictionary, all definitions, pronunciations, and parts of speech that apply to a single word are going to be found right under its heading and there is absolutely NO way for other words that have the same spelling to have a different page. Therefore, making text
the primary key makes sense, and I won't need to have a word_id
.
My question now is, which method will perform faster? It looks like giving it an integer primary key is better since it is an easily comparable primitive type, especially helpful when checking it as a foreign key of other tables. I'm not sure, but I think that if the primary key were a string, checking it against other tables' foreign keys involves an underlying per-character comparison which takes longer, plus the added burden of case-insensitive checking.
Also, if speed is not such a huge issue, are there any other factors I should consider? The database I'm about to use is MySQL.