I have a django model that started to have its ids increment strangely.
The postgres definition of the column (generated from Django Model):
id | integer | not null default nextval('billing_invoice_id_seq'::regclass)
tpg=> SELECT MAX(id) FROM billing_invoice;
max
-------
16260
Then I created a new record through the django admin:
tpg=> SELECT MAX(id) FROM billing_invoice;
max
-------
17223
tpg=> SELECT nextval('billing_invoice_id_seq');
nextval
---------
17224
Then I created a new record which skipped the 17224 value and was inserted with primary key of 17225:
tpg=> SELECT nextval('billing_invoice_id_seq');
nextval
---------
17226
Does anyone have any idea why this is occurring? The application doesn't care at this point because the ids are still incrementing, but over the last couple new objects the PKs have skipped from 427 -> 4357 in one insert and then to 8378 in 2 objects it jumped to 97xx then in 3 objects it jumped to 14k.