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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T14:24:30+00:00 2026-05-12T14:24:30+00:00

Recently I was told to add auto_increment primary key to all our tables because

  • 0

Recently I was told to add auto_increment primary key to all our tables because our database is going to be replicated (master-master solution). All our tables had some kind of primary key, but not all of them were autoincremented.

I looked through mysql documentation about replication and I didn’t find any indication that this (auto_increment primary key) is required. So, did I miss something? Is it better to have autoincremented primary keys when database is going to be replicated?

  • 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-12T14:24:31+00:00Added an answer on May 12, 2026 at 2:24 pm

    Autoincrement primary keys are absolutely not required, but they’re one of the more straightforward and simple ways of dealing with the funky entertainment you’re about to have when dealing with integer primary keys and multi-master replication. You’ll need to ensure that newly inserted rows on each master are able to be uniquely identified. You don’t want server A to insert row 1 at the same time as server B inserts row 1, as when they transmit their logs to each other, they’ll both complain about the duplicate key when they try to insert each other’s row.

    You’ll want to read up on the auto_increment_increment and auto_increment_offset configuration settings, which will make autoincrement work sanely with multi-master.

    Also, tables that use natural primary keys are sometimes (but not always) perfectly safe for multi-master replication. It depends entirely on the frequency and nature of inserts.

    This being said, multi-master is a last resort and a bad idea unless you have a highly experienced MySQL DBA on staff. I say this from experience, as my employer has a three server multi-master replication loop in production.

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

Sidebar

Related Questions

I work at an eCommerce company. Our DBA recently told me that using SQL
Recently I was told, I have to migrate our Perforce repository to TrueChange (McCabe
A consultant told me recently that he has clients using IIS. Those servers accept
I recently found an article online that told me about this: RewriteRule ^mock-up/([^/]+)/([^/]+) /mock-up/index.php?page=$1&section=$2
I cannot remember where, but recently I passed a comment where the user told
Recently one of our app servers went down, when it was rebooted the Python
Recently I was asked to develop an app, which basically is going to use
Recently I've found how to add a link to an item in Visual Studio
I was recently told casting [NSNull null] to (NSString*) was terrible. However, -[NSDictionary stringForKey:]
I was recently told it was bad practice to haved marked a number of

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.