Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
442 views
in Technique[技术] by (71.8m points)

python - 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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...