PostgreSQL Data Types
· 3 min read
PostgreSQL offers a wide range of data types that can be broadly categorized as follows:
1. Numeric Types
- Small Integer:
SMALLINT(2 bytes, range: -32,768 to +32,767) - Integer:
INTEGERorINT(4 bytes, range: -2,147,483,648 to +2,147,483,647) - Big Integer:
BIGINT(8 bytes, range: -9,223,372,036,854,775,808 to +9,223,372,036,854,775,807) - Decimal/Numeric:
DECIMAL(p, s)orNUMERIC(p, s)(User-defined precision) - Real:
REAL(4 bytes, single-precision floating-point) - Double Precision:
DOUBLE PRECISION(8 bytes, double-precision floating-point) - Serial:
SERIAL,BIGSERIAL,SMALLSERIAL(Auto-incrementing integers)