For concurrency reasons, the auto-increment value cannot "roll back" with your transaction. If another process inserted records during your transaction, you run the risk of encountering your identifiers later.
As an example, suppose that your transaction in process βAβ captures identifiers 1,2 and 3. Another process βBβ starts and receives identifiers 4 and 5. If the person rolled back with your transaction and the next process βCβ 5 identifiers were required, it would have turned out 1,2,3,4,5, but 4 and 5 were already occupied by process "B".
source share