What is the correct data type for a unique key in postgresql DB?


which data type should I choose for a unique key (id of a user for example) in postgresql database's table?
does bigint is the one?


Use the serial type for automatically incrementing unique ids.

If you plan to have more than two billion entries, use bigserial. serial is the PostgresSQL equivalent of MySQL's AUTO_INCREMENT.

PostgresSQL Documentation: Numeric Types