Monday, 15 July 2013

How to handle fragmentation of auto increament ID column in MySQL -


I have a table with an auto_increment field, and sometimes the rows are removed so auto_ignature breaks out Whether there is a way to avoid this, at the very least, how to write a SQL query:

  1. auto_increment changes the value to max (
  2. I know how to write the 1 section

  3. New Auto_increment and 2 but do I Can I put them in the same question?

    If this is not possible:

    How do I select "selection" (return) Code> auto_increment value or auto_increment Value + 1?

Renumbering will cause confusion. To record current report 99 , And if the system is hired then it can be recorded on record 98, now all the reports (and populated UI) are wrong once you allocate a unique ID , Then it is found to be stable.

Using ID fields for anything other than a simple unique number is going to be problematic. Due to a requirement for "no interval", it is incompatible to be capable of just delta. You may mark deleted records instead of being deleted. So there really is no difference that you are producing numerical invoices: You will have an unclaimed invoice with that number, instead of removing it.


No comments:

Post a Comment