T
T
t38c3j2016-08-21 19:58:13
MySQL
t38c3j, 2016-08-21 19:58:13

How to decrease AUTO_INCREMENT?

There are records in the table with A_I `id`
and so there is a big gap between 15000 and 700000
how can AUTO_INCREMENT be returned to the value of 15000, I tried to set it but the value is reset to 700k

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
surefire, 2016-08-22
@surefire

Most likely you are using INSERT ON DUPLICATE KEY UPDATE or a similar mechanism that tries to insert records and stumbles. It is he who winds up AUTO_INCREMENT.
To solve it, you need to use a transaction, in which the existence of a duplicate is first checked, and then manipulation is performed.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question