What Is Postgresql Serial Primary Key

A primary key is a special field in a database table that contains unique values. The PostgreSQL SERIAL pseudo-type can be used to define auto-incremented columns in tables. This pseudo-type is used frequently in the primary key column of a table.

Is serial a primary key?

NameStorage SizeRangeSERIAL4 bytes1 to 2,147,483,647BIGSERIAL8 bytes1 to 9,223,372,036,854,775,807

What does the serial keyword do and when do you use it?

SERIAL data type allows you to automatically generate unique integer numbers (IDs, identity, auto-increment, sequence) for a column.

Robert Thorne

Robert Thorne

Automotive & Future Transportation Editor

Robert Thorne covers electric vehicle innovations, autonomous driving systems, global mobility trends, and automotive engineering developments.

Share this article
Twitter Facebook Pinterest