Should I use Postgres' bigserial for records in a new application? Should I use Postgres' bigserial for records in a new application? postgresql postgresql

Should I use Postgres' bigserial for records in a new application?


As far as performance is concerned there is no difference - assuming that PostgreSQL has been properly compiled to take advantage of x86_64 platform. For example, adding two 32-bit ints takes the same time as adding 64-bit ints. However, if it was compiled for plain x86 (32-bit), there will be some (marginal?) drop in performance because it somehow needs to emulate 64-bit arithmetic using only 32-bit registers.

In a nutshell: make sure you use 64-bit version of PostgreSQL and you should be good to go!


There is no significant performance problems with bigserial datatype as sequence and primary key of a table. For details read documentation and older question about subject.

BTW: if you have 10000 devices and each device produce 10 records per day, integer is enough for 60 years so I think integer is enough ;-)