I was asked the following questions:What is your take on the difference between having a char vs. varchar column as part of a primary key? Is there a general rule for this? Should it be varchar or is there a benefit to having it as a char? I never thought of this before. I don't think it matters if it is varchar or char but I really don't know. I was wondering what the thoughts of the experts were.
So, we're talking about a composite PRIMARY KEY? From the logical level doesn't it really matter. On the physical level, there are some bytes you save when using a VARCHAR. Personally I think the difference isn't significant. Let alone that I think that a character column as PRIMARY KEY is not the best choice at all.
In the real sens for the size, I suggest to char instead of varchar only if it is less than 10 chars. The overhead of a varchar isn't worth it if it is less than 10, but is definitely worth it before you reach 50! For instance few columns of type char(50) with only 10-30 chars in them waste a lot of space. Over a couple thousand (or hundreds of thousands) rows, that is a lot of hollow space in the database, which is not good.