I've got a Ruby web app running on Heroku with a Postgres database. I've noticed the auto-incremented IDs have a gap in them around the time that the Postgres database was under "maintenance" by Heroku.
The gap is a one-time thing, and then the IDs increment by 1 again. Like so:
ID | Created at |
2959 | 2016-02-14 21:07:05.149797 |
2960 | 2016-02-14 21:15:05.03284 |
2961 | 2016-02-14 22:59:19.634962 |
2994 | 2016-02-15 09:25:30.969881 |
2995 | 2016-02-15 09:44:38.49678 |
2996 | 2016-02-15 09:51:00.282624 |
The maintenance by Heroku happened in between the two records (2961
and 2994
) being created, at 2016-02-15 04:00:00
.
I've seen an explanation that a failed transaction will result in an ID being skipped over on the next successful commit, but I can't see anything in the application logs to indicate that any records were being created around the time.