Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

django id integer limit

Is there a limit to the AutoField in a Django model or the database back-ends?

The Django project I am working on could potentially see a lot of objects in certain database tables which would be in excess of 40000 within a short amount of time.

I am using Sqlite for dev and Postgresql for production.

like image 560
Taco Python Avatar asked Aug 27 '12 23:08

Taco Python


1 Answers

Adding this as an answer. Django maps this to serial columns which means that the maximum value is in the 2 billion range ( 2,147,483,647 to be exact). While that is unlikely to be an issue for most applications, if you do, you could alter the type to become a bigint instead and this would make it highly unlikely you will ever reach the end of 64-bit int space.

like image 185
Chris Travers Avatar answered Sep 30 '22 00:09

Chris Travers