How do I get future keys from a Mysql InnoDb?
Oracle and Postgres both have the concept of sequences and a nextval-function. Mysql seems to be a bit different.
Is there some easy sql statement to pull maybe 1000 future keys for a certain auto-increment field, and be sure no other transaction can pull these values at the same time or any time in the future?
For InnoDb table you can do this:
Oracle and Postgres both have the concept of sequences and a nextval-function. Mysql seems to be a bit different.
In MySQL you could do this to find next value -
SELECT MAX(id) + 1 FROM table_name;
But there is no guarantee that AUTO_INCREMENT works in the same way.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.