Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

batch bulk insert gaps #263

Open
Gabilabrebi opened this issue Nov 30, 2023 · 1 comment
Open

batch bulk insert gaps #263

Gabilabrebi opened this issue Nov 30, 2023 · 1 comment

Comments

@Gabilabrebi
Copy link

Gabilabrebi commented Nov 30, 2023

When using batch to bulk insert, gaps in AUTO_INCREMENT IDs are created when reaching 50+ inserts even with innodb_autoinc_lock_mode set to 1 (consecutive)

The mySQL, documentation says :

With innodb_autoinc_lock_mode set to 0 (“traditional”) or 1 (“consecutive”), the auto-increment values generated by any given statement are consecutive, without gaps, because the table-level AUTO-INC lock is held until the end of the statement, and only one such statement can execute at a time.

So I'm not sure that's intended. Due to the fact that insertId, only return one ID, i think it's very important to not have gaps in IDs so we can deduce inserted ones.

@rusher
Copy link
Collaborator

rusher commented Dec 5, 2023

Actually I'm not sure recreate the insert ids is the way to go.
If ID's are needed, better to disable bulk, setting option bulk to false. This will permit to retrieve all id's, even if slower (this is still faster than normal INSERT * number of bunch of parameter, because of pipelining).
In the near futur, this will be permitted with https://jira.mariadb.org/browse/MDEV-30366

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants