Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 156381
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T10:19:10+00:00 2026-05-11T10:19:10+00:00

Basically, I will need to combine product data from multiple vendors into a single

  • 0

Basically, I will need to combine product data from multiple vendors into a single database (it’s more complex than that, of course) which has several tables that will need to be joined together for most OLTP operations.

I was going to stick with the default and use an auto-incrementing integer as the primary key, but while one vendor supplies their own ‘ProductiD’ field, the rest do not and I would have to do a lot of manual mapping to the other tables then to load the data (as I would have to first load it into the Products table, then pull the ID out and add that along with the other information I need to the other tables).

Alternatively, I could use the product’s SKU as it’s primary key since the SKU is unique for a single product, and all of the vendors supply a SKU in their data feeds. If I use the SKU as the PK then I could easily load the data feeds as everything is based off of the SKU, which is how it works in the real world. However the SKU is alphanumeric and will probably be slightly less efficient than an integer-based key.

Any ideas on which I should look at?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T10:19:10+00:00Added an answer on May 11, 2026 at 10:19 am

    This is a choice between surrogate and natural primary keys.

    IMHO always favour surrogate primary keys. Primary keys shouldn’t have meaning because that meaning can change. Even country names can change and countries can come into existence and disappear, let alone products. Changing primary keys is definitely not advised, which can happen with natural keys.

    More on surrogate vs primary keys:

    So surrogate keys win right? Well, let’s review and see if any of the con’s of natural key’s apply to surrogate keys:

    • Con 1: Primary key size – Surrogate keys generally don’t have problems with index size since they’re usually a single column of type int. That’s about as small as it gets.
    • Con 2: Foreign key size – They don’t have foreign key or foreign index size problems either for the same reason as Con 1.
    • Con 3: Asthetics – Well, it’s an eye of the beholder type thing, but they certainly don’t involve writing as much code as with compound natural keys.
    • Con 4 & 5: Optionality & Applicability – Surrogate keys have no problems with people or things not wanting to or not being able to provide the data.
    • Con 6: Uniqueness – They are 100% guaranteed to be unique. That’s a relief.
    • Con 7: Privacy – They have no privacy concerns should an unscrupulous person obtain them.
    • Con 8: Accidental Denormalization – You can’t accidentally denormalize non-business data.
    • Con 9: Cascading Updates – Surrogate keys don’t change, so no worries about how to cascade them on update.
    • Con 10: Varchar join speed – They’re generally int’s, so they’re generally as fast to join over as you can get.

    And there’s also Surrogate Keys vs Natural Keys for Primary Key?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 387k
  • Answers 387k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I can see a few solutions: After fixing the format… May 15, 2026 at 12:06 am
  • Editorial Team
    Editorial Team added an answer It depends on whether you have a cascade in the… May 15, 2026 at 12:06 am
  • Editorial Team
    Editorial Team added an answer min-width:200px May 15, 2026 at 12:06 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.