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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T16:11:44+00:00 2026-05-27T16:11:44+00:00

When I set a primary key as AUTO INCREMENT, the ordinal number continue increase

  • 0

When I set a primary key as AUTO INCREMENT, the ordinal number continue increase when I delete a key.

For example, I have a record with id=5 in my table, then I delete it, and when I insert a new record it never re-use id=5 again. I think it wastes a lot resources (please correct me if my thought is wrong). How can I re-use these deleted id number?

  • 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-27T16:11:44+00:00Added an answer on May 27, 2026 at 4:11 pm

    It doesn’t waste that many resources, you’d need to delete and insert a lot of rows before you ran out. The INT size in Mysql is ~2 billion rows. If you used unsigned it’s 4 billion.

    The problem with re-using the keys is, if you have a table with the first table as a foreign key, and your delete doesn’t cascade you could accidentally link the wrong rows together when joining the tables.

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

Sidebar

Related Questions

I have a primary key set up to auto increment. I am doing multiple
I have table with following structure id int auto increment, primary key uid int
An SQL table has auto increment property set for the primary key AnnotationID of
I have a Table which has a Primary Key field which is not set
I have a table that has its primary key set to autoincrement. This table
I have some code that produces a set of primary key values that I
I have a table with ' id ' as the primary field and set
Right now, I have a table whose primary key is an auto_increment field. However,
I have a set of tables where each table's ID key is auto_incrementing. Now
Have a large table here with no primary key and im trying to add

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.