The Wayback Machine - https://web.archive.org/web/20220204213139/https://github.com/laravel/framework/discussions/38938
Skip to content

upsert Auto Increment is increasing a lot #38938

upsert Auto Increment is increasing a lot #38938
Sep 24, 2021 · 2 answers

I have started using upsert (with MySql) and it's very cool and useful for me. I'm using it to import data from another system. But I have noticed that the Auto Increment of the id field jumps up a lot.

For example here, the initial data load, had 41'284 entries. Until here everything is correct. It's a job that runs in every hour because the other system can bring new data. Now the Auto Increment is at 604'645, but there are just 14 more entries since the first load.

Does anybody has the same experience with upsert?

To me it almost looks like that it does the auto increment without checking if it was a new entry or if a entry was updated.

image

Replies

2 suggested answers

Unfortunately, that's how UPSERT queries work on MySQL: https://stackoverflow.com/a/23517191/4848587

0 replies
Answer selected by ChrisSantiago82

Yes, that is what I thought. And it isn't a real issue, just doesn't look that nice.

0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants