View Poll Results: Should an EmailDomain table use the name as key or a unique integer key?

2. You may not vote on this poll
  • Use the domain's name as key. Less lookups and easier to synch across db systems.

    1 50.00%
  • Use a unique integer key. On a large scale system, this will use less space.

    1 50.00%
  • Other/Doesn't matter

    0 0%
Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2003

    Unanswered: Table Design Question

    I want to have a table "EmailDomain". "EmailDomain" records will represent an email domain such as "" or "". The text name, makes a perfect primary key. However, wouldn't it be more space efficient (even if a little more awkward to work with) if I used a unique integer key instead?

    If I have 1 million user records that reference an email domain, wouldn't the space savings be significant? (1 million ints vs 1 million varchar(50) fields)

    I wanted to hear what other experienced DB people thought on this.

  2. #2
    Join Date
    Oct 2003

    Thumbs up

    It certainly does save space, and produce a more efficient index, to use an integer or similar short key. This approach would be logical if the number of choices is reasonably small; not so appropriate if most users are in different domains.
    In any case, don't worry too much about "resources" anymore. "A million records" really isn't that many, odd though that may seem to a human.
    ChimneySweep(R): fast, automatic
    table repair at a click of the

  3. #3
    Join Date
    Oct 2003
    I never ever put "business-info" in a primary key. NEVER.

    "", "" are "business" informations, and hence do not qualify as a primary key. In your case, an integer value should be the primary key of your "domain" table. Define a unique constraint on your "text".

    About ressources, sundialsvcs is right. One million rows is nothing impressive.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts