Reputation: 5066
I'm going to use Django's ArrayField to store a pretty massive list of maybe 500-50,000 items. They're short Ids like 283974892598353920
, but I'm worried about hitting some upper limit. Are there any limits for Django's Postgres ArrayField?
Upvotes: 1
Views: 1779
Reputation: 657202
If your IDs are made of digits exclusively and stay below 2^63 (
9223372036854780000), I suggest an array of bigint
as data type: bigint[]
. That occupies 8 bytes per element (plus a little overhead).
Your given example 283974892598353920 is roughly 2^60 and well within that range.
The only relevant Postgres limit is the maximum field size of 1 GB, allowing roughly 2^60 elements. 50,000 isn't even close.
Related:
Still, consider sets (tables) instead of huge arrays if you want to do any kind of queries on the data. Performance deteriorates for huge arrays.
Upvotes: 3