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

  • Home
  • SEARCH
  • 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 267779
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T23:36:14+00:00 2026-05-11T23:36:14+00:00

Is there a reason to use a single incrementing field for a primary key

  • 0

Is there a reason to use a single incrementing field for a primary key instead of multiple fields that actually represent the unique record?

I’m working on an existing php application, and the tables all seem to have a single ‘id’ key instead of using the 2 or more fields that are actually unique to the record (like user, auction, bid).

I’m not a database expert, but that just seems lazy (or inexperienced) to me. Is there any benefit (performance or otherwise)?

Updated: I’m not referring to psudo-unique data (ssn, e-mail address, etc), where you may want to ensure the data is really unique. I’m talking about tables with obvious foreign key references, but instead of using those references along with the unique field(s) in the table itself, every table just has an incrementing ID.

Not trying to start up a subjective debate, it just didn’t make sense to me.

  • 1 1 Answer
  • 3 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-11T23:36:15+00:00Added an answer on May 11, 2026 at 11:36 pm

    Using synthetic primary keys has several advantages:

    • You can change values in key fields without having to take an index update hit
    • The indexes are smaller
    • It makes foreign key relationships simpler
    • Since you’re not dealing with strings, there are never encoding issues

    Databases often have specific optimizations around building indexes with monotonically incrementing keys.

    That being said, there is nothing wrong with a little denormalization now and then. If the use-case is clear and the tables are relatively small, do what’s convenient.

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

Sidebar

Ask A Question

Stats

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

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

    • 7 Answers
  • Editorial Team

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

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Use the following function like this: Image('/path/to/original.image', '1/1', '150*', './thumb.jpg');… May 13, 2026 at 2:13 am
  • Editorial Team
    Editorial Team added an answer Check you database schema to see if the field (referenced… May 13, 2026 at 2:13 am
  • Editorial Team
    Editorial Team added an answer I figured out the problem - there was a session… May 13, 2026 at 2:13 am

Related Questions

I'm trying to figure out how to decide when to use NSDictionary or NSCoder/NSCoding?
For example, imagine a simple mutator that takes a single boolean parameter: void SetValue(const
I have multiple website projects in a single repository each of which have a
Occasionally I'll write a PHP function with a single input, an associative array containing

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.