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 527497
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T08:53:21+00:00 2026-05-13T08:53:21+00:00

We are having a rather long discussion in our company about whether or not

  • 0

We are having a rather long discussion in our company about whether or not to put an autoincrement key on EVERY table in our database.

I can understand putting one on tables that would have a FK reference to, but I kind-of dislike putting such keys on each and every one of our tables, even though the keys would never be used.

Please help with pros and cons for putting autoincrement keys on every table apart from taking extra space and slowing everything a little bit (we have some tables with hundreds of millions of records).

Thanks

  • 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. Editorial Team
    Editorial Team
    2026-05-13T08:53:21+00:00Added an answer on May 13, 2026 at 8:53 am

    I’m assuming that almost all tables will have a primary key – and it’s just a question of whether that key consists of one or more natural keys or a single auto-incrementing surrogate key. If you aren’t using primary keys then you will generally get a lot of advantages of using them on almost all tables.

    So, here are some pros & cons of surrogate keys. First off, the pros:

    • Most importantly: they allow the natural keys to change. Trivial example, a table of persons should have a primary key of person_id rather than last_name, first_name.
    • Read performance – very small indexes are faster to scan. However, this is only helpful if you’re actually constraining your query by the surrogate key. So, good for lookup tables, not so good for primary tables.
    • Simplicity – if named appropriately, it makes the database easy to learn & use.
    • Capacity – if you’re designing something like a data warehouse fact table – surrogate keys on your dimensions allow you to keep a very narrow fact table – which results in huge capacity improvements.

    And cons:

    • They don’t prevent duplicates of the natural values. So, you’ll still usually want a unique constraint (index) on the logical key.
    • Write performance. With an extra index you’re going to slow down inserts, updates and deletes that much more.
    • Simplicity – for small tables of data that almost never changes they are unnecessary. For example, if you need a list of countries you can use the ISO list of countries. It includes meaningful abbreviations. This is better than a surrogate key because it’s both small and useful.

    In general, surrogate keys are useful, just keep in mind the cons and don’t hesitate to use natural keys when appropriate.

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

Sidebar

Related Questions

I am having this rather long json output in my controller, I wish to
I have a table (or rather a long join) with fields (id, name, prio)
Im having rather an annoying problem. I have a class called Person and a
I am having a rather odd problem with the Gecko Webbrowser control, I have
I've been having this rather frustrating problem, and having failed so many times, I'm
I'm having a rather odd issue where the menu for an activity works totally
I have a bunch of unit tests (Test1, Test2, etc.), but rather than having
I am having a heck of time with something that seems rather straightforward but
I am seeking for the advantages of having Spring deployed on Tomcat rather then
I am having a rather, for me, complicated mysql query on which I am

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.